<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>PHPBuilder.com</title>
		<link>http://www.phpbuilder.com/board</link>
		<description>This is a discussion forum for discussing all aspects of the serverside scripting language PHP</description>
		<language>en</language>
		<lastBuildDate>Sun, 22 Nov 2009 13:01:00 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.phpbuilder.com/board/images/misc/rss.jpg</url>
			<title>PHPBuilder.com</title>
			<link>http://www.phpbuilder.com/board</link>
		</image>
		<item>
			<title>Search before Adding (PHP/Mysql)</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369712&amp;goto=newpost</link>
			<pubDate>Sun, 22 Nov 2009 11:32:48 GMT</pubDate>
			<description><![CDATA[Hi.
Well i've been trying to make a little script for a mates website.
What it does, you type something into a text field, it searches the database for the value in that textfield, if there is an entry already like that in the database, it will not add it, if there isn't, it will add into the database.
Kinda like a Registration form (But its not, same principle)

Here is my code (Some bits edited out)


Code:
---------
<?php

$dbhost = "mysql"; //Database Host
$dbuser = "###"; //Database User
$dbpass = "###"; //Database Password
$dbname = "###"; //Database Name

//connect
$db = mysql_pconnect($dbhost,$dbuser,$dbpass);
mysql_select_db("$dbname",$db); 

	$searchdb="SELECT * FROM ### WHERE keywords ='$_POST[###]';
	$result=mysql_query($searchdb);
	$num=mysql_num_rows($result);
	
	if ($num = 0){
        echo "No results found";
	}else{
echo "Found results";
}

?>
---------
Now im sure i haven't missed any ; because i have looked over it, and i have viewed tutorials online that use this code almost EXACT (Just changed entires etc).

But here is the error:


Code:
---------
Parse error: syntax error, unexpected T_STRING in /hosted/subs/ulmb.com/t/h/###/public_html/### on line 19
---------
Eh, im probably being an idiot again lols. I need to learn errors asap.
But thanks.]]></description>
			<content:encoded><![CDATA[<div>Hi.<br />
Well i've been trying to make a little script for a mates website.<br />
What it does, you type something into a text field, it searches the database for the value in that textfield, if there is an entry already like that in the database, it will not add it, if there isn't, it will add into the database.<br />
Kinda like a Registration form (But its not, same principle)<br />
<br />
Here is my code (Some bits edited out)<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;?php<br />
<br />
$dbhost = &quot;mysql&quot;; //Database Host<br />
$dbuser = &quot;###&quot;; //Database User<br />
$dbpass = &quot;###&quot;; //Database Password<br />
$dbname = &quot;###&quot;; //Database Name<br />
<br />
//connect<br />
$db = mysql_pconnect($dbhost,$dbuser,$dbpass);<br />
mysql_select_db(&quot;$dbname&quot;,$db); <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; $searchdb=&quot;SELECT * FROM ### WHERE keywords ='$_POST[###]';<br />
&nbsp; &nbsp; &nbsp; &nbsp; $result=mysql_query($searchdb);<br />
&nbsp; &nbsp; &nbsp; &nbsp; $num=mysql_num_rows($result);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if ($num = 0){<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;No results found&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }else{<br />
echo &quot;Found results&quot;;<br />
}<br />
<br />
?&gt;</code><hr />
</div>Now im sure i haven't missed any ; because i have looked over it, and i have viewed tutorials online that use this code almost EXACT (Just changed entires etc).<br />
<br />
But here is the error:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Parse error: syntax error, unexpected T_STRING in /hosted/subs/ulmb.com/t/h/###/public_html/### on line 19</code><hr />
</div>Eh, im probably being an idiot again lols. I need to learn errors asap.<br />
But thanks.</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>thatshanekid</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369712</guid>
		</item>
		<item>
			<title>Email confirmation form.</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369711&amp;goto=newpost</link>
			<pubDate>Sun, 22 Nov 2009 08:14:42 GMT</pubDate>
			<description><![CDATA[Is this possible.

Is it possible to create a new file each time someone submits a form that changes the URL so the previous user can't revisit the link?

So for instance

User submits form. Some script then copies that same form and complete page template and all, then changes the pages file name.

So

User 1 visits form1.php - submits the form, then on submission a script then creates a new page named form2.php deleting form1.php and uploads somehow to the webserver. 

Or even creating a random number so people can't cheat and cycle through simple numbers if they figure it out.

Ill pay anyone to figure this out. Or suggest another way.]]></description>
			<content:encoded><![CDATA[<div>Is this possible.<br />
<br />
Is it possible to create a new file each time someone submits a form that changes the URL so the previous user can't revisit the link?<br />
<br />
So for instance<br />
<br />
User submits form. Some script then copies that same form and complete page template and all, then changes the pages file name.<br />
<br />
So<br />
<br />
User 1 visits form1.php - submits the form, then on submission a script then creates a new page named form2.php deleting form1.php and uploads somehow to the webserver. <br />
<br />
Or even creating a random number so people can't cheat and cycle through simple numbers if they figure it out.<br />
<br />
Ill pay anyone to figure this out. Or suggest another way.</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>TwistedLogix</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369711</guid>
		</item>
		<item>
			<title>Uploading files in database</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369710&amp;goto=newpost</link>
			<pubDate>Sun, 22 Nov 2009 05:52:52 GMT</pubDate>
			<description>Need help!...I wanted to create a simple document management system  and i want a  sample codes for uploading text files .pdf files,/ .doc files and etc.. directly to the database..and also viewing all files that already uploaded and ready for download...
Hope you can help me....
thank you...</description>
			<content:encoded><![CDATA[<div>Need help!...I wanted to create a simple document management system  and i want a  sample codes for uploading text files .pdf files,/ .doc files and etc.. directly to the database..and also viewing all files that already uploaded and ready for download...<br />
Hope you can help me....<br />
thank you...</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>belat</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369710</guid>
		</item>
		<item>
			<title>How to receive a ping</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369709&amp;goto=newpost</link>
			<pubDate>Sun, 22 Nov 2009 05:32:42 GMT</pubDate>
			<description>Looking for some guide, code examples, on how to receive a ping from a blog. Not sending, but receiving, so I know when the blog is updated.

Any pointers to some guides?</description>
			<content:encoded><![CDATA[<div>Looking for some guide, code examples, on how to receive a ping from a blog. Not sending, but receiving, so I know when the blog is updated.<br />
<br />
Any pointers to some guides?</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=2">General Help</category>
			<dc:creator>TheBeginner</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369709</guid>
		</item>
		<item>
			<title>Dynamic variable based on database record/recall - Help?</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369708&amp;goto=newpost</link>
			<pubDate>Sun, 22 Nov 2009 02:19:47 GMT</pubDate>
			<description><![CDATA[OK, ill keep this as short as I can..

I am trying to create a truly scalable environment for my users and so allow them to..
1. define a new option (dshop_options_name)
2. define option values (dshop_options_values)
separate tables in the database

this is to allow distinct values to be assigned and also in any combination.
ok, the script is in 2 parts. The form page and the result page

** form.php (using POST)

first I need to create dropdowns dynamically based on the options assigned to the product, and then run through the dshop_options_values table to get any values assigned to that option

//////////////////////////////////////////////////////////////////////////////////////////

$prod_prop_name=mysql_query("SELECT * FROM `dshop_options_name`");
	$prod_prop_name_array= array();
	while($data9=mysql_fetch_array($prod_prop_name)) {
	$prod_prop_name_array[]=$data9;
	}

	foreach($prod_prop_name_array as $rowNum => $data9) {
	$prod_prop_id=$data9[0];
	$prod_prop_title=$data9[1];
	
$prod_prop_attri=mysql_query("SELECT * FROM `dshop_options_values` WHERE `prod_id`='".$selected_product."' AND `attri_name`='".$prod_prop_title."' ORDER BY `attri_value` ASC ");
	$prod_prop_attri_array= array();
	while($data10=mysql_fetch_array($prod_prop_attri)) {
	$prod_prop_attri_array[]=$data10;
	}	
		if(!$prod_prop_attri_array){}
		else{
		echo"<div class='left'>";
		echo"$prod_prop_title\n";?>
        <select name='<? echo $prod_prop_title?>'>
        <option value="select">Select</option>
        <?php	
		foreach($prod_prop_attri_array as $rowNum => $data10){
		$itemname=$data10[2];
		$itemvalue=$data10[3];
		$itemprice=$data10[4];
		if($itemprice<="0"){
		echo"<option value='".$itemvalue."'>".$itemvalue."</option>\n";
		}
		else{
		echo"<option value='".$itemvalue."'>".$itemvalue."&nbsp;-&nbsp;".$currency_type.$itemprice."</option>\n";
		}		
		}
		echo"</select></br></br></div>";
		}
	}

//////////////////////////////////////////////////////////////////////////////////////////

ok, as you can see, I name the select the same as the option name, this is so I then use that name to again call the value in the next script.


** result.php

Ok, to reasemble the data posted, I again, do a few calls to get all the data 

//////////////////////////////////////////////////////////////////////////////////////////

$prod_prop_name=mysql_query("SELECT * FROM `dshop_options_name`");
	$prod_prop_name_array= array();
	while($data9=mysql_fetch_array($prod_prop_name)) {
	$prod_prop_name_array[]=$data9;
	}
	foreach($prod_prop_name_array as $rowNum => $data9){
	$option_id=$data9[0];
	$option_name=$data9[1];
	$varnval=$_REQUEST[$option_name];
//echo"$varnval";
	$results = array();
	
		if(!$varnval | $varnval=="select"){}
		else{
		$results[] = $option_name."-".$varnval;
		$optpricesum_query=mysql_query("SELECT * FROM `dshop_options_values` WHERE `attri_name`='".$option_name."' AND `attri_value`='".$varnval."'");
		$optpricesum_result=mysql_fetch_array($optpricesum_query);
		$optpricesum=$optpricesum_result[4];
		}
		if(!$varnval | $varnval=="select"){}
		else{
		for ($i=0;$i<=0;$i++){$options.=$results[$i]." | ";}
		}
	}

//////////////////////////////////////////////////////////////////////////////////////////

ok, down to the issue...

in the form.php, I am posting a value dynamically created, essentially by the admin user.

Lets say they created an option "Foo", and the values "foo1", "foo2", "foo3" (in the admin area)

form.php builds the selects by cross referencing the two tables, names the select and then populates it (nothing is pre-defined)

then the end user arrives at the form on the front end and on posting the form, they selected "foo3"

result.php at first has nothing to _REQUEST (remember we had nothing to define)  until it rebuilds the possible vaiables that could have been posted.
I then used the foreach to run through all the option names stored with the hope of then creating dynamic variables... 
$varnval=$_REQUEST[$option_name]; 

I then filter the names that have not been posted with..
if(!$varnval | $varnval=="select"){}

now...

Locally I get the value "foo3" no problem, but not on the web server. I then noticed that when using local php (Xampp) values dont even need to be defined $var=$_POST['var']; it will still work.... annoying when debugging!! BUT shows to apoint anyways, that the script will work.

I places an echo after the $varnval $_REQUEST, but nothing displays.

It seems to me that the $_REQUEST is not getting the variable, either because of the parse or because I have just missed something.

I have spent days working on this, trying many different ways but all threads lead nowhere.

Maybe I am trying the impossible, but I feel there has to be a way to create a set of variables from database records alone (NOT the other way around as most searches seem to produce)

This is my first post here, so i apologise if it is in the wrong place!

I thank you in advance for any help

Kelso]]></description>
			<content:encoded><![CDATA[<div>OK, ill keep this as short as I can..<br />
<br />
I am trying to create a truly scalable environment for my users and so allow them to..<br />
1. define a new option (dshop_options_name)<br />
2. define option values (dshop_options_values)<br />
separate tables in the database<br />
<br />
this is to allow distinct values to be assigned and also in any combination.<br />
ok, the script is in 2 parts. The form page and the result page<br />
<br />
** form.php (using POST)<br />
<br />
first I need to create dropdowns dynamically based on the options assigned to the product, and then run through the dshop_options_values table to get any values assigned to that option<br />
<br />
//////////////////////////////////////////////////////////////////////////////////////////<br />
<br />
$prod_prop_name=mysql_query(&quot;SELECT * FROM `dshop_options_name`&quot;);<br />
	$prod_prop_name_array= array();<br />
	while($data9=mysql_fetch_array($prod_prop_name)) {<br />
	$prod_prop_name_array[]=$data9;<br />
	}<br />
<br />
	foreach($prod_prop_name_array as $rowNum =&gt; $data9) {<br />
	$prod_prop_id=$data9[0];<br />
	$prod_prop_title=$data9[1];<br />
	<br />
$prod_prop_attri=mysql_query(&quot;SELECT * FROM `dshop_options_values` WHERE `prod_id`='&quot;.$selected_product.&quot;' AND `attri_name`='&quot;.$prod_prop_title.&quot;' ORDER BY `attri_value` ASC &quot;);<br />
	$prod_prop_attri_array= array();<br />
	while($data10=mysql_fetch_array($prod_prop_attri)) {<br />
	$prod_prop_attri_array[]=$data10;<br />
	}	<br />
		if(!$prod_prop_attri_array){}<br />
		else{<br />
		echo&quot;&lt;div class='left'&gt;&quot;;<br />
		echo&quot;$prod_prop_title\n&quot;;?&gt;<br />
        &lt;select name='&lt;? echo $prod_prop_title?&gt;'&gt;<br />
        &lt;option value=&quot;select&quot;&gt;Select&lt;/option&gt;<br />
        &lt;?php	<br />
		foreach($prod_prop_attri_array as $rowNum =&gt; $data10){<br />
		$itemname=$data10[2];<br />
		$itemvalue=$data10[3];<br />
		$itemprice=$data10[4];<br />
		if($itemprice&lt;=&quot;0&quot;){<br />
		echo&quot;&lt;option value='&quot;.$itemvalue.&quot;'&gt;&quot;.$itemvalue.&quot;&lt;/option&gt;\n&quot;;<br />
		}<br />
		else{<br />
		echo&quot;&lt;option value='&quot;.$itemvalue.&quot;'&gt;&quot;.$itemvalue.&quot;&amp;nbsp;-&amp;nbsp;&quot;.$currency_type.$itemprice.&quot;&lt;/option&gt;\n&quot;;<br />
		}		<br />
		}<br />
		echo&quot;&lt;/select&gt;&lt;/br&gt;&lt;/br&gt;&lt;/div&gt;&quot;;<br />
		}<br />
	}<br />
<br />
//////////////////////////////////////////////////////////////////////////////////////////<br />
<br />
ok, as you can see, I name the select the same as the option name, this is so I then use that name to again call the value in the next script.<br />
<br />
<br />
** result.php<br />
<br />
Ok, to reasemble the data posted, I again, do a few calls to get all the data <br />
<br />
//////////////////////////////////////////////////////////////////////////////////////////<br />
<br />
$prod_prop_name=mysql_query(&quot;SELECT * FROM `dshop_options_name`&quot;);<br />
	$prod_prop_name_array= array();<br />
	while($data9=mysql_fetch_array($prod_prop_name)) {<br />
	$prod_prop_name_array[]=$data9;<br />
	}<br />
	foreach($prod_prop_name_array as $rowNum =&gt; $data9){<br />
	$option_id=$data9[0];<br />
	$option_name=$data9[1];<br />
	$varnval=$_REQUEST[$option_name];<br />
//echo&quot;$varnval&quot;;<br />
	$results = array();<br />
	<br />
		if(!$varnval | $varnval==&quot;select&quot;){}<br />
		else{<br />
		$results[] = $option_name.&quot;-&quot;.$varnval;<br />
		$optpricesum_query=mysql_query(&quot;SELECT * FROM `dshop_options_values` WHERE `attri_name`='&quot;.$option_name.&quot;' AND `attri_value`='&quot;.$varnval.&quot;'&quot;);<br />
		$optpricesum_result=mysql_fetch_array($optpricesum_query);<br />
		$optpricesum=$optpricesum_result[4];<br />
		}<br />
		if(!$varnval | $varnval==&quot;select&quot;){}<br />
		else{<br />
		for ($i=0;$i&lt;=0;$i++){$options.=$results[$i].&quot; | &quot;;}<br />
		}<br />
	}<br />
<br />
//////////////////////////////////////////////////////////////////////////////////////////<br />
<br />
ok, down to the issue...<br />
<br />
in the form.php, I am posting a value dynamically created, essentially by the admin user.<br />
<br />
Lets say they created an option &quot;Foo&quot;, and the values &quot;foo1&quot;, &quot;foo2&quot;, &quot;foo3&quot; (in the admin area)<br />
<br />
form.php builds the selects by cross referencing the two tables, names the select and then populates it (nothing is pre-defined)<br />
<br />
then the end user arrives at the form on the front end and on posting the form, they selected &quot;foo3&quot;<br />
<br />
result.php at first has nothing to _REQUEST (remember we had nothing to define)  until it rebuilds the possible vaiables that could have been posted.<br />
I then used the foreach to run through all the option names stored with the hope of then creating dynamic variables... <br />
$varnval=$_REQUEST[$option_name]; <br />
<br />
I then filter the names that have not been posted with..<br />
if(!$varnval | $varnval==&quot;select&quot;){}<br />
<br />
now...<br />
<br />
Locally I get the value &quot;foo3&quot; no problem, but not on the web server. I then noticed that when using local php (Xampp) values dont even need to be defined $var=$_POST['var']; it will still work.... annoying when debugging!! BUT shows to apoint anyways, that the script will work.<br />
<br />
I places an echo after the $varnval $_REQUEST, but nothing displays.<br />
<br />
It seems to me that the $_REQUEST is not getting the variable, either because of the parse or because I have just missed something.<br />
<br />
I have spent days working on this, trying many different ways but all threads lead nowhere.<br />
<br />
Maybe I am trying the impossible, but I feel there has to be a way to create a set of variables from database records alone (NOT the other way around as most searches seem to produce)<br />
<br />
This is my first post here, so i apologise if it is in the wrong place!<br />
<br />
I thank you in advance for any help<br />
<br />
Kelso</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=2">General Help</category>
			<dc:creator>kelsofield</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369708</guid>
		</item>
		<item>
			<title>Php link exporter</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369707&amp;goto=newpost</link>
			<pubDate>Sun, 22 Nov 2009 00:19:18 GMT</pubDate>
			<description><![CDATA[Hello...can anyone around here help me make this script...i saw it somewhere it should be simple...so..
I'm some sort of newbie in this...what i wanna make is a php script that will put an input field on the page for url of some forum page...like:
http://www.phpbuilder.com/board/newthread.php?do=newthread&f=10
and a button below it. When the button is pressed the script will search the source code of the page and export links that begins with "http://www.google.com/" (for example) and print it on the page one below the other...
Example:
[img]http://img265.imageshack.us/img265/2237/32881531.jpg[/img]

Please answer as quick as you can i really need this.

Thanks ;)]]></description>
			<content:encoded><![CDATA[<div>Hello...can anyone around here help me make this script...i saw it somewhere it should be simple...so..<br />
I'm some sort of newbie in this...what i wanna make is a php script that will put an input field on the page for url of some forum page...like:<br />
<a rel="nofollow" href="http://www.phpbuilder.com/board/newthread.php?do=newthread&amp;f=10" target="_blank">http://www.phpbuilder.com/board/newt...newthread&amp;f=10</a><br />
and a button below it. When the button is pressed the script will search the source code of the page and export links that begins with &quot;http://www.google.com/&quot; (for example) and print it on the page one below the other...<br />
Example:<br />
<a href="http://img265.imageshack.us/img265/2237/32881531.jpg" target="_blank">http://img265.imageshack.us/img265/2237/32881531.jpg</a><br />
<br />
Please answer as quick as you can i really need this.<br />
<br />
Thanks ;)</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>The_L</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369707</guid>
		</item>
		<item>
			<title>calculate total in simple shopping cart</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369706&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 22:30:19 GMT</pubDate>
			<description><![CDATA[Hi,

I'm doing a very simple shopping cart for my website and I'm quite rusty at PHP and have forgotten how to calculate the grand total in my shopping cart. I am able to calculate the subtotal in every row but now I need to get the total of all the rows put together. 

Basically I have a mysql database which records all the products added to a cart during a session. In my basket.php file, I retrieve all the products for this particular session using a database query as follows:

<?php
$result = mysql_query( "SELECT * FROM Shopping_sessions WHERE Session_id='$ses_id'", $db);
if (!$result) {
echo("<p>Error performing query1: " . mysql_error() . "</p>");
exit();
} 
?>
<table width="100%" cellpadding="3" cellspacing="0" bgcolor="#FAF9CF">
  <tr>
  <td height="30"><strong>Item</strong></td>
  <td width="120"><strong>Quantity</strong></td>
  <td width="80"><strong>Item Price</strong></td>
  <td width="80"><strong>Subtotal</strong></td>
  </tr>
  <?php
while($row = mysql_fetch_array($result)){
$Product_quantity = $row["Quantity"];
$Product_id = $row["Product_id"];
$result2 = mysql_query( "SELECT * FROM Products WHERE Product_id=$Product_id", $db);
if (!$result2) {
echo("<p>Error performing query1: " . mysql_error() . "</p>");
exit();
} // query
$row2 = mysql_fetch_array($result2);
$Product_name = $row2["Product_name"];
$Product_price = $row2["Product_price"];
$total1 = $Product_quantity * $Product_price;
$total2 = number_format($total1, 2);
echo "<tr>    <td>$Product_name</td>
    <td>$Product_quantity</td>
    <td>$Product_price</td>
    <td>$total2</td>
  </tr>";
  }
?>

*// SO FAR SO GOOD, HERE IS WHERE I NEED HELP*
  
How do I calculate the combined value of $total2?]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I'm doing a very simple shopping cart for my website and I'm quite rusty at PHP and have forgotten how to calculate the grand total in my shopping cart. I am able to calculate the subtotal in every row but now I need to get the total of all the rows put together. <br />
<br />
Basically I have a mysql database which records all the products added to a cart during a session. In my basket.php file, I retrieve all the products for this particular session using a database query as follows:<br />
<br />
&lt;?php<br />
$result = mysql_query( &quot;SELECT * FROM Shopping_sessions WHERE Session_id='$ses_id'&quot;, $db);<br />
if (!$result) {<br />
echo(&quot;&lt;p&gt;Error performing query1: &quot; . mysql_error() . &quot;&lt;/p&gt;&quot;);<br />
exit();<br />
} <br />
?&gt;<br />
&lt;table width=&quot;100%&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#FAF9CF&quot;&gt;<br />
  &lt;tr&gt;<br />
  &lt;td height=&quot;30&quot;&gt;&lt;strong&gt;Item&lt;/strong&gt;&lt;/td&gt;<br />
  &lt;td width=&quot;120&quot;&gt;&lt;strong&gt;Quantity&lt;/strong&gt;&lt;/td&gt;<br />
  &lt;td width=&quot;80&quot;&gt;&lt;strong&gt;Item Price&lt;/strong&gt;&lt;/td&gt;<br />
  &lt;td width=&quot;80&quot;&gt;&lt;strong&gt;Subtotal&lt;/strong&gt;&lt;/td&gt;<br />
  &lt;/tr&gt;<br />
  &lt;?php<br />
while($row = mysql_fetch_array($result)){<br />
$Product_quantity = $row[&quot;Quantity&quot;];<br />
$Product_id = $row[&quot;Product_id&quot;];<br />
$result2 = mysql_query( &quot;SELECT * FROM Products WHERE Product_id=$Product_id&quot;, $db);<br />
if (!$result2) {<br />
echo(&quot;&lt;p&gt;Error performing query1: &quot; . mysql_error() . &quot;&lt;/p&gt;&quot;);<br />
exit();<br />
} // query<br />
$row2 = mysql_fetch_array($result2);<br />
$Product_name = $row2[&quot;Product_name&quot;];<br />
$Product_price = $row2[&quot;Product_price&quot;];<br />
$total1 = $Product_quantity * $Product_price;<br />
$total2 = number_format($total1, 2);<br />
echo &quot;&lt;tr&gt;    &lt;td&gt;$Product_name&lt;/td&gt;<br />
    &lt;td&gt;$Product_quantity&lt;/td&gt;<br />
    &lt;td&gt;$Product_price&lt;/td&gt;<br />
    &lt;td&gt;$total2&lt;/td&gt;<br />
  &lt;/tr&gt;&quot;;<br />
  }<br />
?&gt;<br />
<br />
<b>// SO FAR SO GOOD, HERE IS WHERE I NEED HELP</b><br />
  <br />
How do I calculate the combined value of $total2?</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>mayandy</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369706</guid>
		</item>
		<item>
			<title>PhP Mysql query blog latest results</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369704&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 19:52:27 GMT</pubDate>
			<description>Hi guys,
I need your help. I have a blog and on a complete different page my homepage. Now what I want to do is that if I post a new post on my blog that the first 35 words  of it appear in a layer, and then as well next to it the publish date. 
I realized that I would need to create an mysql query which comes up with the last entry,
How can I do that? And then which is probably more complicated how can I tell mysql to give me just 35 words, or can I limit in any way the layer????
I am helpless! I would deeply appreciate if someone could help me!
Thanks!</description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
I need your help. I have a blog and on a complete different page my homepage. Now what I want to do is that if I post a new post on my blog that the first 35 words  of it appear in a layer, and then as well next to it the publish date. <br />
I realized that I would need to create an mysql query which comes up with the last entry,<br />
How can I do that? And then which is probably more complicated how can I tell mysql to give me just 35 words, or can I limit in any way the layer????<br />
I am helpless! I would deeply appreciate if someone could help me!<br />
Thanks!</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>gwolff2005</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369704</guid>
		</item>
		<item>
			<title>Problems with Function + SQL</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369701&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 13:35:38 GMT</pubDate>
			<description><![CDATA[Hey All,

Im having a problem with a query and function im writing.

I have 2 database tables.

The first one, lets call it scores, has the columns email, correct, time, stamp and month

the second table, which is called users, has email, dispname, country

example of the first table
----------------------------------------------
| email | correct | time | stamp | month |
| test@test.com | 3 | 2 | 12345678 | 11 |
| test@test.com | 6 | 12 | 12345678 | 11 |
| testing@testing.com | 12 | 30 | 12345678 | 11 |
| testing@testing.com | 122 | 10 | 12345678 | 11 |
---------------------------------------------------------

So what i need to do is extract all the rows with the same email address and the same month, then add the correct fields and the time fields together so i am left with the following result
----------------------------------------------
| email | correct | time | stamp | month |
| test@test.com | 9 | 4 | 12345678 | 11 |
| testing@testing.com | 134 | 40 | 12345678 | 11 |
---------------------------------------------------------

and so on for every email address that happens to be inserted into the scores table.

Once that that has been completed, i need to find the top 10 people with the highest "correct" score and with the lowest "time" score, so they are ranked according to their score and time.

Once the top 10 have been found, i then need to search the 'users' table to find the dispname and country of each of the outputted top 10 users.

and finally i need to display the top 10 as:

rank - dispname - country - correct - time

If anyone could help me out .... i would be so greatful ... its doing my head in something bad hahah

Thanks]]></description>
			<content:encoded><![CDATA[<div>Hey All,<br />
<br />
Im having a problem with a query and function im writing.<br />
<br />
I have 2 database tables.<br />
<br />
The first one, lets call it scores, has the columns email, correct, time, stamp and month<br />
<br />
the second table, which is called users, has email, dispname, country<br />
<br />
example of the first table<br />
----------------------------------------------<br />
| email | correct | time | stamp | month |<br />
| <a href="mailto:test@test.com">test@test.com</a> | 3 | 2 | 12345678 | 11 |<br />
| <a href="mailto:test@test.com">test@test.com</a> | 6 | 12 | 12345678 | 11 |<br />
| <a href="mailto:testing@testing.com">testing@testing.com</a> | 12 | 30 | 12345678 | 11 |<br />
| <a href="mailto:testing@testing.com">testing@testing.com</a> | 122 | 10 | 12345678 | 11 |<br />
---------------------------------------------------------<br />
<br />
So what i need to do is extract all the rows with the same email address and the same month, then add the correct fields and the time fields together so i am left with the following result<br />
----------------------------------------------<br />
| email | correct | time | stamp | month |<br />
| <a href="mailto:test@test.com">test@test.com</a> | 9 | 4 | 12345678 | 11 |<br />
| <a href="mailto:testing@testing.com">testing@testing.com</a> | 134 | 40 | 12345678 | 11 |<br />
---------------------------------------------------------<br />
<br />
and so on for every email address that happens to be inserted into the scores table.<br />
<br />
Once that that has been completed, i need to find the top 10 people with the highest &quot;correct&quot; score and with the lowest &quot;time&quot; score, so they are ranked according to their score and time.<br />
<br />
Once the top 10 have been found, i then need to search the 'users' table to find the dispname and country of each of the outputted top 10 users.<br />
<br />
and finally i need to display the top 10 as:<br />
<br />
rank - dispname - country - correct - time<br />
<br />
If anyone could help me out .... i would be so greatful ... its doing my head in something bad hahah<br />
<br />
Thanks</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=6">Database</category>
			<dc:creator>intervelopment</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369701</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] remove values from string]]></title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369700&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 13:21:42 GMT</pubDate>
			<description>I have a string of numeric ids in a comma separated format


PHP:
---------
$IDs = 23,34,55,42,33,41,22 ... 6767,4556;
---------
I also have a table that may have some values that should be removed from the string of IDs. How do I do that?</description>
			<content:encoded><![CDATA[<div>I have a string of numeric ids in a comma separated format<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">PHP Code:</div>
	<div class="alt2">
		<hr />
		<code style="white-space:nowrap">
		<div dir="ltr" style="text-align:left;">
			<!-- php buffer start --><code><font color="#000000">
<font color="#0000BB">$IDs </font><font color="#007700">= </font><font color="#0000BB">23</font><font color="#007700">,</font><font color="#0000BB">34</font><font color="#007700">,</font><font color="#0000BB">55</font><font color="#007700">,</font><font color="#0000BB">42</font><font color="#007700">,</font><font color="#0000BB">33</font><font color="#007700">,</font><font color="#0000BB">41</font><font color="#007700">,</font><font color="#0000BB">22 </font><font color="#007700">... </font><font color="#0000BB">6767</font><font color="#007700">,</font><font color="#0000BB">4556</font><font color="#007700">; <br /></font><font color="#0000BB"></font>
</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div>I also have a table that may have some values that should be removed from the string of IDs. How do I do that?</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>zzz</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369700</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] register_globals]]></title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369699&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 12:36:40 GMT</pubDate>
			<description><![CDATA[my old scripts which were designed for me about 4 years ago required registered_globals to be on. 

I never knew this but in October my host got rid of this feature and my scripts do not work. It won't allow me to have a .htaccess file, but i can have a php.ini file

my host is Yahoo.

This only needs to be temp as all new scripts are in the works and should be done soon.

any help on what i might need to make this work is appriciated]]></description>
			<content:encoded><![CDATA[<div>my old scripts which were designed for me about 4 years ago required registered_globals to be on. <br />
<br />
I never knew this but in October my host got rid of this feature and my scripts do not work. It won't allow me to have a .htaccess file, but i can have a php.ini file<br />
<br />
my host is Yahoo.<br />
<br />
This only needs to be temp as all new scripts are in the works and should be done soon.<br />
<br />
any help on what i might need to make this work is appriciated</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=2">General Help</category>
			<dc:creator>msnhockey</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369699</guid>
		</item>
		<item>
			<title>Can someone modify this easy code please</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369698&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 11:11:20 GMT</pubDate>
			<description><![CDATA[<?php $links = array
( 
'<a href="link1" />HERE</a>',
'<a href="link2" />HERE</a>',
'<a href="link3" />HERE</a>',
'<a href="link4" />HERE</a>',
'<a href="link5" />HERE</a>',
'<a href="link6" />HERE</a>',
); 

$max = count($links)-1;
$rand = rand(0, $max);
?>

<?print $links[$rand];?>

I need it to go in order from top down, then start again. Not random like it is.

Thanks.]]></description>
			<content:encoded><![CDATA[<div>&lt;?php $links = array<br />
( <br />
'&lt;a href=&quot;link1&quot; /&gt;HERE&lt;/a&gt;',<br />
'&lt;a href=&quot;link2&quot; /&gt;HERE&lt;/a&gt;',<br />
'&lt;a href=&quot;link3&quot; /&gt;HERE&lt;/a&gt;',<br />
'&lt;a href=&quot;link4&quot; /&gt;HERE&lt;/a&gt;',<br />
'&lt;a href=&quot;link5&quot; /&gt;HERE&lt;/a&gt;',<br />
'&lt;a href=&quot;link6&quot; /&gt;HERE&lt;/a&gt;',<br />
); <br />
<br />
$max = count($links)-1;<br />
$rand = rand(0, $max);<br />
?&gt;<br />
<br />
&lt;?print $links[$rand];?&gt;<br />
<br />
I need it to go in order from top down, then start again. Not random like it is.<br />
<br />
Thanks.</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>TwistedLogix</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369698</guid>
		</item>
		<item>
			<title>Mail functionality from localhost to server</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369697&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 08:43:32 GMT</pubDate>
			<description><![CDATA[Hi 

I am facing problem of mail functionality.

When i tested mail functionality in my localhost it works fine but when i tried it on server it didn't work and also no error it displays.

So please give me solution if any changes required to setting mail functionality on server from local.

Thanks in advance

Anish Panchal
Software Outsourcing India (http://www.tatvasoft.com)
Web Development Company India (http://www.sparsh-technologies.com)]]></description>
			<content:encoded><![CDATA[<div>Hi <br />
<br />
I am facing problem of mail functionality.<br />
<br />
When i tested mail functionality in my localhost it works fine but when i tried it on server it didn't work and also no error it displays.<br />
<br />
So please give me solution if any changes required to setting mail functionality on server from local.<br />
<br />
Thanks in advance<br />
<br />
Anish Panchal<br />
<a rel="nofollow" href="http://www.tatvasoft.com" target="_blank">Software Outsourcing India</a><br />
<a rel="nofollow" href="http://www.sparsh-technologies.com" target="_blank">Web Development Company India</a></div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=2">General Help</category>
			<dc:creator>asparsh</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369697</guid>
		</item>
		<item>
			<title>youtube integration</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369696&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 05:38:17 GMT</pubDate>
			<description><![CDATA[A friend of mine coded this but it suddenly stopped working.

After placing the youtube URL into the field, it displays the error, "The video details cannot be retrieved.". We like that the error detection works but why did it break?


Code:
---------
<?php
include('application.php');
if ($myID == 0) goto('login.php');
_v('e;i:eid');

if ($mode == 'e')
{
   $main .= "<center><br><br>
      The video cannot be found. <br> <br> <br>
      <input type='button' name='b1' class='bttn' value='< Go Back' onclick=\"location.replace('myvideos.php');\">
    </center>";
}

if ($mode == 'delete')
{
   $qc = mysql_query("SELECT * FROM `video` WHERE `vid_id` = '$eid' AND `vid_useid` = '$myID'");
   if (mysql_num_rows($qc) == 0) goto('myvideos.php');
   $rc = mysql_fetch_assoc($qc);
   extract($rc);
   if ($vid_thumb != '') @unlink("$base_path/photo/video/$vid_thumb");
   $qd = mysql_query("DELETE FROM `video` WHERE `vid_id` = '$eid' AND `vid_useid` = '$myID' LIMIT 1");
   goto('myvideos.php');
}

// Add From Youtube

if ($mode == 'addys')
{
   _v('ttl,dsc,ytc,tags,thumb,v__id,catid');
   $now = date('Y-m-d H:i:s');
   $url = gen_url($ttl, 60, 'video', 'vid_url');
   $fname = '';

   if ($m_ytc != '') $hcode = $m_ytc;
   else $hcode = '<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/'.$v__id.'&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'.$v__id.'&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>';
   $tags = make_tags($tags, ' ');

   $qins = mysql_query("INSERT INTO `video`
     (`vid_useid`, `vid_catid`, `vid_title`, `vid_url`, `vid_desc`, `vid_code`, `vid_date`, `vid_enabled`, `vid_tags`, `vid_thumb`) VALUES 
     ('$myID', '$catid', '$m_ttl', '$url', '$m_dsc', '$hcode', '$now', '1', '$tags', '$fname')") or die(mysql_error());
   $last = mysql_insert_id();

   $yfile = "http://i2.ytimg.com/vi/$v__id/default.jpg";
   $fname = 'vt'.$last.'.'.'jpg';
   $thumb = new thumb($yfile, 'jpg', "photo/video/$fname");
   $thumb -> fixed(120, 90);
   if (!file_exists("photo/video/$fname")) $fname = '';
   $qupd = mysql_query("UPDATE `video` SET `vid_thumb` = '$fname' WHERE `vid_id` = '$last'");
   goto('myvideos.php');
}

if ($mode == 'adda')
{
   _v('vurl');
   $info = get_youtube_info($vurl);
   if ($info['error'] != '') { $mode = 'addy';  $e = 1; }
   else
   {
      extract($info);
      $cj = new jsValid('frmab');
      $cj->addf('ttl,catid');
      $js = $cj->show(1, 0);
      $main .= "<form action='myvideos.php' method='post' name='frmab' id='frmab' style='margin:0px' enctype='multipart/form-data'><input type='hidden' name='mode' value='addys'><input type='hidden' name='thumb' value='$thumb'><input type='hidden' name='v__id' value='$v__id'>
         <table border='0' cellspacing='2' cellpadding='3' align='center' width='400'>
          <tr><td><b>Title</b>:<br><input type='text' name='ttl' value=\"$title\" class='input' style='width:340px'></td></tr>
          <tr><td><br><b>Category</b>:<br>".sel_db('catid', 'category', 'cat_id', 'cat_name', "`cat_type` = 'videos'", '', '- Select -', 'input', '', '238')."</td></tr>
          <tr><td><b>Description</b>:<br><textarea name='dsc' class='input' style='width:340px;height:100px'>$desc</textarea></td></tr>
          <tr><td><b>Tags</b>: <br><input type='text' name='tags' value=\"$tags\" class='input' style='width:340px'></td></tr>
          <tr><td align='center'><br><input type='submit' name='sub' class='bttn' value='Add Video'> &nbsp; &nbsp; <input type='button' name='cnc' class='bttn' value='Cancel' onclick=\"location.replace('myvideos.php');\"></td></tr>
         </table></form>$js";
   }
}

if ($mode == 'edits')
{
   _v('ttl,catid,dsc,tags');
   $tags = make_tags($m_tags, ' ');
   $qupd = mysql_query("UPDATE `video` SET `vid_catid` = '$m_catid', `vid_title` = '$m_ttl', `vid_desc` = '$m_dsc', `vid_tags` = '$tags' WHERE `vid_id` = '$eid' AND `vid_useid` = '$myID'");
   goto("$base_url/myvideos.php");
}

if ($mode == 'edit')
{
   $qv = mysql_query("SELECT * FROM `video` WHERE `vid_id` = '$eid' AND `vid_useid` = '$myID'");
   if (mysql_num_rows($qv) == 0) goto("$base_url/myvideos.php");
   $rv = mysql_fetch_assoc($qv);
   extract($rv);
   $tags = unmake_tags($vid_tags, ',');
   
   $cj = new jsValid('frmab');
   $cj->addf('ttl,catid');
   $js = $cj->show(1, 0);
   $main .= tab('Edit Video', 600);
   $main .= "<form action='myvideos.php' method='post' name='frmab' id='frmab' style='margin:0px' enctype='multipart/form-data'><input type='hidden' name='mode' value='edits'><input type='hidden' name='eid' value='$eid'>
       <table border='0' cellspacing='2' cellpadding='3' align='center' width='400'>
        <tr><td><b>Title</b>:<br><input type='text' name='ttl' value=\"$vid_title\" class='input' style='width:340px'></td></tr>
        <tr><td><br><b>Category</b>:<br>".sel_db('catid', 'category', 'cat_id', 'cat_name', "`cat_type` = 'videos'", $vid_catid, '', 'input', '', '238')."</td></tr>
        <tr><td><b><br>Description</b>:<br><textarea name='dsc' class='input' style='width:340px;height:100px'>$vid_desc</textarea></td></tr>
        <tr><td><b>Tags</b>: <br><input type='text' name='tags' value=\"$tags\" class='input' style='width:340px'></td></tr>
        <tr><td align='center'><br><input type='submit' name='sub' class='bttn' value='Update'> &nbsp; &nbsp; <input type='button' name='cnc' class='bttn' value='Cancel' onclick=\"location.replace('myvideos.php');\"></td></tr>
       </table></form>$js";
   $main .= tabe();
}


if ($mode == 'addy')
{
   $main = "
     <form action='myvideos.php' method='post' name='frmab' id='frmab' style='margin:0px' enctype='multipart/form-data'>
     <input type='hidden' name='mode' value='adda'>
     <center><br>
     Please enter the YOUTUBE URL of the video <br>
     <i>eq: http://www.youtube.com/watch?v=B5i3mQhtNtg</i><br><br>
       <input type='text' name='vurl' class='input' style='width:300px'><br><br>
       <input type='submit' name='sub' class='bttn' value='Continue >'> &nbsp; &nbsp;
       <input type='button' name='cnc' class='bttn' value='Cancel' onclick=\"location.replace('myvideos.php')\">
   </center>";
   if ($e == 1) $main .= "<center><font color='red'>The video details cannot be retrieved.</font>";
}


if ($mode == '')
{
   $main .= tab2('My Videos', "<input type='button' name='b1' class='bttn' value='Add Youtube Video' onclick=\"location.replace('$base_url/myvideos.php?mode=addy');\">", 650);
   $main .= "<div style='margin:10px'>";
   $qe = mysql_query("SELECT * FROM `video` WHERE `vid_useid` = '$myID' ORDER BY `vid_id` DESC");
   if (mysql_num_rows($qe) == 0) $main .= "<center><br>You have not added any videos yet.</center>";
   else
   {
      $main .= "<table border='0' cellspacing='4' cellpadding='3' width='600' align='center'>";
      while ($re = mysql_fetch_assoc($qe))
      {
         extract($re);
         $thumb = '&nbsp;';
         if ($vid_thumb != '') $thumb = "<img src='photo/video/$vid_thumb' border='0'>";
         $vid_desc = mktext($vid_desc, 250);
         $vlink = URL::video($vid_id, $vid_url);
         $main .= "
             <tr>
              <td width='140' valign='top'><a href='$vlink'>$thumb</a></td>
              <td width='460' valign='top'>
                <a class='evtt' href='$vlink'>$vid_title</a>
                <div style='margin-top:5px;line-height:17px'>$vid_desc</div>
                <div style='margin-top:3px;color:#555555;line-height:19px'>
                     <a href='myvideos.php?mode=edit&eid=$vid_id'>Edit Video</a> &nbsp;
                     <a href='#' onclick=\"if (confirm('Are you sure you want to delete this video?')==true) location.replace('myvideos.php?mode=delete&eid=$vid_id');\">Delete Video</a></div>
              </td>
             </tr><tr><td colspan='2'><div style='border-top:1px solid #C7C7C7;height:2px;margin-top:4px;'>&nbsp;</div></td></tr>";
      }
      $main .= "</table>";
   }
   $main .= "<center><br><br>
       <input type='button' name='b1' class='bttn' value='Add Youtube Video' onclick=\"location.replace('$base_url/myvideos.php?mode=addy');\"> &nbsp; &nbsp;        
     </center></div>";
   $main .= tabe();
   $main .= "<div style='line-height:19px;margin-left:20px;margin-bottom:20px'>Easily import your favorite YouTube videos and share them with members. No uploading required. <br /> <a href='".URL::page('faq')."'>Support</a> </div>";
}

$_vtemplate['main'] = $main;
$_vtemplate['right'] = $right;
$tp = new page($_vtemplate, 'template/default2.html');
---------
]]></description>
			<content:encoded><![CDATA[<div>A friend of mine coded this but it suddenly stopped working.<br />
<br />
After placing the youtube URL into the field, it displays the error, &quot;The video details cannot be retrieved.&quot;. We like that the error detection works but why did it break?<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;?php<br />
include('application.php');<br />
if ($myID == 0) goto('login.php');<br />
_v('e;i:eid');<br />
<br />
if ($mode == 'e')<br />
{<br />
&nbsp;  $main .= &quot;&lt;center&gt;&lt;br&gt;&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp; The video cannot be found. &lt;br&gt; &lt;br&gt; &lt;br&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;input type='button' name='b1' class='bttn' value='&lt; Go Back' onclick=\&quot;location.replace('myvideos.php');\&quot;&gt;<br />
&nbsp; &nbsp; &lt;/center&gt;&quot;;<br />
}<br />
<br />
if ($mode == 'delete')<br />
{<br />
&nbsp;  $qc = mysql_query(&quot;SELECT * FROM `video` WHERE `vid_id` = '$eid' AND `vid_useid` = '$myID'&quot;);<br />
&nbsp;  if (mysql_num_rows($qc) == 0) goto('myvideos.php');<br />
&nbsp;  $rc = mysql_fetch_assoc($qc);<br />
&nbsp;  extract($rc);<br />
&nbsp;  if ($vid_thumb != '') @unlink(&quot;$base_path/photo/video/$vid_thumb&quot;);<br />
&nbsp;  $qd = mysql_query(&quot;DELETE FROM `video` WHERE `vid_id` = '$eid' AND `vid_useid` = '$myID' LIMIT 1&quot;);<br />
&nbsp;  goto('myvideos.php');<br />
}<br />
<br />
// Add From Youtube<br />
<br />
if ($mode == 'addys')<br />
{<br />
&nbsp;  _v('ttl,dsc,ytc,tags,thumb,v__id,catid');<br />
&nbsp;  $now = date('Y-m-d H:i:s');<br />
&nbsp;  $url = gen_url($ttl, 60, 'video', 'vid_url');<br />
&nbsp;  $fname = '';<br />
<br />
&nbsp;  if ($m_ytc != '') $hcode = $m_ytc;<br />
&nbsp;  else $hcode = '&lt;object width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/'.$v__id.'&amp;hl=en&quot;&gt;&lt;/param&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/'.$v__id.'&amp;hl=en&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/embed&gt;&lt;/object&gt;';<br />
&nbsp;  $tags = make_tags($tags, ' ');<br />
<br />
&nbsp;  $qins = mysql_query(&quot;INSERT INTO `video`<br />
&nbsp; &nbsp;  (`vid_useid`, `vid_catid`, `vid_title`, `vid_url`, `vid_desc`, `vid_code`, `vid_date`, `vid_enabled`, `vid_tags`, `vid_thumb`) VALUES <br />
&nbsp; &nbsp;  ('$myID', '$catid', '$m_ttl', '$url', '$m_dsc', '$hcode', '$now', '1', '$tags', '$fname')&quot;) or die(mysql_error());<br />
&nbsp;  $last = mysql_insert_id();<br />
<br />
&nbsp;  $yfile = &quot;http://i2.ytimg.com/vi/$v__id/default.jpg&quot;;<br />
&nbsp;  $fname = 'vt'.$last.'.'.'jpg';<br />
&nbsp;  $thumb = new thumb($yfile, 'jpg', &quot;photo/video/$fname&quot;);<br />
&nbsp;  $thumb -&gt; fixed(120, 90);<br />
&nbsp;  if (!file_exists(&quot;photo/video/$fname&quot;)) $fname = '';<br />
&nbsp;  $qupd = mysql_query(&quot;UPDATE `video` SET `vid_thumb` = '$fname' WHERE `vid_id` = '$last'&quot;);<br />
&nbsp;  goto('myvideos.php');<br />
}<br />
<br />
if ($mode == 'adda')<br />
{<br />
&nbsp;  _v('vurl');<br />
&nbsp;  $info = get_youtube_info($vurl);<br />
&nbsp;  if ($info['error'] != '') { $mode = 'addy';&nbsp; $e = 1; }<br />
&nbsp;  else<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp; extract($info);<br />
&nbsp; &nbsp; &nbsp; $cj = new jsValid('frmab');<br />
&nbsp; &nbsp; &nbsp; $cj-&gt;addf('ttl,catid');<br />
&nbsp; &nbsp; &nbsp; $js = $cj-&gt;show(1, 0);<br />
&nbsp; &nbsp; &nbsp; $main .= &quot;&lt;form action='myvideos.php' method='post' name='frmab' id='frmab' style='margin:0px' enctype='multipart/form-data'&gt;&lt;input type='hidden' name='mode' value='addys'&gt;&lt;input type='hidden' name='thumb' value='$thumb'&gt;&lt;input type='hidden' name='v__id' value='$v__id'&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;table border='0' cellspacing='2' cellpadding='3' align='center' width='400'&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;b&gt;Title&lt;/b&gt;:&lt;br&gt;&lt;input type='text' name='ttl' value=\&quot;$title\&quot; class='input' style='width:340px'&gt;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;br&gt;&lt;b&gt;Category&lt;/b&gt;:&lt;br&gt;&quot;.sel_db('catid', 'category', 'cat_id', 'cat_name', &quot;`cat_type` = 'videos'&quot;, '', '- Select -', 'input', '', '238').&quot;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;:&lt;br&gt;&lt;textarea name='dsc' class='input' style='width:340px;height:100px'&gt;$desc&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;b&gt;Tags&lt;/b&gt;: &lt;br&gt;&lt;input type='text' name='tags' value=\&quot;$tags\&quot; class='input' style='width:340px'&gt;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td align='center'&gt;&lt;br&gt;&lt;input type='submit' name='sub' class='bttn' value='Add Video'&gt; &amp;nbsp; &amp;nbsp; &lt;input type='button' name='cnc' class='bttn' value='Cancel' onclick=\&quot;location.replace('myvideos.php');\&quot;&gt;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;/table&gt;&lt;/form&gt;$js&quot;;<br />
&nbsp;  }<br />
}<br />
<br />
if ($mode == 'edits')<br />
{<br />
&nbsp;  _v('ttl,catid,dsc,tags');<br />
&nbsp;  $tags = make_tags($m_tags, ' ');<br />
&nbsp;  $qupd = mysql_query(&quot;UPDATE `video` SET `vid_catid` = '$m_catid', `vid_title` = '$m_ttl', `vid_desc` = '$m_dsc', `vid_tags` = '$tags' WHERE `vid_id` = '$eid' AND `vid_useid` = '$myID'&quot;);<br />
&nbsp;  goto(&quot;$base_url/myvideos.php&quot;);<br />
}<br />
<br />
if ($mode == 'edit')<br />
{<br />
&nbsp;  $qv = mysql_query(&quot;SELECT * FROM `video` WHERE `vid_id` = '$eid' AND `vid_useid` = '$myID'&quot;);<br />
&nbsp;  if (mysql_num_rows($qv) == 0) goto(&quot;$base_url/myvideos.php&quot;);<br />
&nbsp;  $rv = mysql_fetch_assoc($qv);<br />
&nbsp;  extract($rv);<br />
&nbsp;  $tags = unmake_tags($vid_tags, ',');<br />
&nbsp;  <br />
&nbsp;  $cj = new jsValid('frmab');<br />
&nbsp;  $cj-&gt;addf('ttl,catid');<br />
&nbsp;  $js = $cj-&gt;show(1, 0);<br />
&nbsp;  $main .= tab('Edit Video', 600);<br />
&nbsp;  $main .= &quot;&lt;form action='myvideos.php' method='post' name='frmab' id='frmab' style='margin:0px' enctype='multipart/form-data'&gt;&lt;input type='hidden' name='mode' value='edits'&gt;&lt;input type='hidden' name='eid' value='$eid'&gt;<br />
&nbsp; &nbsp; &nbsp;  &lt;table border='0' cellspacing='2' cellpadding='3' align='center' width='400'&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;b&gt;Title&lt;/b&gt;:&lt;br&gt;&lt;input type='text' name='ttl' value=\&quot;$vid_title\&quot; class='input' style='width:340px'&gt;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;br&gt;&lt;b&gt;Category&lt;/b&gt;:&lt;br&gt;&quot;.sel_db('catid', 'category', 'cat_id', 'cat_name', &quot;`cat_type` = 'videos'&quot;, $vid_catid, '', 'input', '', '238').&quot;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;b&gt;&lt;br&gt;Description&lt;/b&gt;:&lt;br&gt;&lt;textarea name='dsc' class='input' style='width:340px;height:100px'&gt;$vid_desc&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;b&gt;Tags&lt;/b&gt;: &lt;br&gt;&lt;input type='text' name='tags' value=\&quot;$tags\&quot; class='input' style='width:340px'&gt;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td align='center'&gt;&lt;br&gt;&lt;input type='submit' name='sub' class='bttn' value='Update'&gt; &amp;nbsp; &amp;nbsp; &lt;input type='button' name='cnc' class='bttn' value='Cancel' onclick=\&quot;location.replace('myvideos.php');\&quot;&gt;&lt;/td&gt;&lt;/tr&gt;<br />
&nbsp; &nbsp; &nbsp;  &lt;/table&gt;&lt;/form&gt;$js&quot;;<br />
&nbsp;  $main .= tabe();<br />
}<br />
<br />
<br />
if ($mode == 'addy')<br />
{<br />
&nbsp;  $main = &quot;<br />
&nbsp; &nbsp;  &lt;form action='myvideos.php' method='post' name='frmab' id='frmab' style='margin:0px' enctype='multipart/form-data'&gt;<br />
&nbsp; &nbsp;  &lt;input type='hidden' name='mode' value='adda'&gt;<br />
&nbsp; &nbsp;  &lt;center&gt;&lt;br&gt;<br />
&nbsp; &nbsp;  Please enter the YOUTUBE URL of the video &lt;br&gt;<br />
&nbsp; &nbsp;  &lt;i&gt;eq: http://www.youtube.com/watch?v=B5i3mQhtNtg&lt;/i&gt;&lt;br&gt;&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp;  &lt;input type='text' name='vurl' class='input' style='width:300px'&gt;&lt;br&gt;&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp;  &lt;input type='submit' name='sub' class='bttn' value='Continue &gt;'&gt; &amp;nbsp; &amp;nbsp;<br />
&nbsp; &nbsp; &nbsp;  &lt;input type='button' name='cnc' class='bttn' value='Cancel' onclick=\&quot;location.replace('myvideos.php')\&quot;&gt;<br />
&nbsp;  &lt;/center&gt;&quot;;<br />
&nbsp;  if ($e == 1) $main .= &quot;&lt;center&gt;&lt;font color='red'&gt;The video details cannot be retrieved.&lt;/font&gt;&quot;;<br />
}<br />
<br />
<br />
if ($mode == '')<br />
{<br />
&nbsp;  $main .= tab2('My Videos', &quot;&lt;input type='button' name='b1' class='bttn' value='Add Youtube Video' onclick=\&quot;location.replace('$base_url/myvideos.php?mode=addy');\&quot;&gt;&quot;, 650);<br />
&nbsp;  $main .= &quot;&lt;div style='margin:10px'&gt;&quot;;<br />
&nbsp;  $qe = mysql_query(&quot;SELECT * FROM `video` WHERE `vid_useid` = '$myID' ORDER BY `vid_id` DESC&quot;);<br />
&nbsp;  if (mysql_num_rows($qe) == 0) $main .= &quot;&lt;center&gt;&lt;br&gt;You have not added any videos yet.&lt;/center&gt;&quot;;<br />
&nbsp;  else<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp; $main .= &quot;&lt;table border='0' cellspacing='4' cellpadding='3' width='600' align='center'&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; while ($re = mysql_fetch_assoc($qe))<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  extract($re);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  $thumb = '&amp;nbsp;';<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if ($vid_thumb != '') $thumb = &quot;&lt;img src='photo/video/$vid_thumb' border='0'&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  $vid_desc = mktext($vid_desc, 250);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  $vlink = URL::video($vid_id, $vid_url);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  $main .= &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;tr&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;td width='140' valign='top'&gt;&lt;a href='$vlink'&gt;$thumb&lt;/a&gt;&lt;/td&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;td width='460' valign='top'&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;a class='evtt' href='$vlink'&gt;$vid_title&lt;/a&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div style='margin-top:5px;line-height:17px'&gt;$vid_desc&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div style='margin-top:3px;color:#555555;line-height:19px'&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;a href='myvideos.php?mode=edit&amp;eid=$vid_id'&gt;Edit Video&lt;/a&gt; &amp;nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;a href='#' onclick=\&quot;if (confirm('Are you sure you want to delete this video?')==true) location.replace('myvideos.php?mode=delete&amp;eid=$vid_id');\&quot;&gt;Delete Video&lt;/a&gt;&lt;/div&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2'&gt;&lt;div style='border-top:1px solid #C7C7C7;height:2px;margin-top:4px;'&gt;&amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; $main .= &quot;&lt;/table&gt;&quot;;<br />
&nbsp;  }<br />
&nbsp;  $main .= &quot;&lt;center&gt;&lt;br&gt;&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp;  &lt;input type='button' name='b1' class='bttn' value='Add Youtube Video' onclick=\&quot;location.replace('$base_url/myvideos.php?mode=addy');\&quot;&gt; &amp;nbsp; &amp;nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;  &lt;/center&gt;&lt;/div&gt;&quot;;<br />
&nbsp;  $main .= tabe();<br />
&nbsp;  $main .= &quot;&lt;div style='line-height:19px;margin-left:20px;margin-bottom:20px'&gt;Easily import your favorite YouTube videos and share them with members. No uploading required. &lt;br /&gt; &lt;a href='&quot;.URL::page('faq').&quot;'&gt;Support&lt;/a&gt; &lt;/div&gt;&quot;;<br />
}<br />
<br />
$_vtemplate['main'] = $main;<br />
$_vtemplate['right'] = $right;<br />
$tp = new page($_vtemplate, 'template/default2.html');</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>diabloroker</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369696</guid>
		</item>
		<item>
			<title>Live preview of PHP?</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10369695&amp;goto=newpost</link>
			<pubDate>Sat, 21 Nov 2009 03:29:10 GMT</pubDate>
			<description><![CDATA[I'm trying to put together a small subscription-type website.  It will have one main database-type program.   Nothing very elaborate.  For the content pages, I'm using HTML and CSS, of course.  For the program, I expect to use PHP and MySQL.  I'm teaching myself the latter -- as you might expect, I have my good days and my bad days.  :)

I've been looking at editors and have researched them to the point of overload.  Still, I expect that one could help me quite a lot.   One of the features I would most like is a live preview of PHP pages.   But . . . is that a realistic expectation?   

I'm just not in a position right now to purchase anything like Dreamweaver.   I've been looking seriously at Webuilder 2010 (http://www.blumentals.net/webuilder/).   

Two questions, I guess: 
1:  Does anyone know of any reason why Webuilder 2010 would be a bad idea?  (I'll use the trial version first, of course.)  

2:   Would I need to install a web server on my computer in order to have a preview of PHP pages?  I really don't want to do that, I don't think.  How much of a hassle would it be, though?  to what extent would I really need it??   

Any help would be much appreciated, and would probably help me stop going around in all these circles!]]></description>
			<content:encoded><![CDATA[<div>I'm trying to put together a small subscription-type website.  It will have one main database-type program.   Nothing very elaborate.  For the content pages, I'm using HTML and CSS, of course.  For the program, I expect to use PHP and MySQL.  I'm teaching myself the latter -- as you might expect, I have my good days and my bad days.  :)<br />
<br />
I've been looking at editors and have researched them to the point of overload.  Still, I expect that one could help me quite a lot.   One of the features I would most like is a live preview of PHP pages.   But . . . is that a realistic expectation?   <br />
<br />
I'm just not in a position right now to purchase anything like Dreamweaver.   I've been looking seriously at <a rel="nofollow" href="http://www.blumentals.net/webuilder/" target="_blank">Webuilder 2010</a>.   <br />
<br />
Two questions, I guess: <br />
1:  Does anyone know of any reason why Webuilder 2010 would be a bad idea?  (I'll use the trial version first, of course.)  <br />
<br />
2:   Would I need to install a web server on my computer in order to have a preview of PHP pages?  I really don't want to do that, I don't think.  How much of a hassle would it be, though?  to what extent would I really need it??   <br />
<br />
Any help would be much appreciated, and would probably help me stop going around in all these circles!</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>Francoise</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10369695</guid>
		</item>
	</channel>
</rss>
