<?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://board.phpbuilder.com/</link>
		<description>This is a discussion forum for discussing all aspects of the serverside scripting language PHP</description>
		<language>en</language>
		<lastBuildDate>Sat, 18 May 2013 09:23:59 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://board.phpbuilder.com/images/misc/rss.png</url>
			<title>PHPBuilder.com</title>
			<link>http://board.phpbuilder.com/</link>
		</image>
		<item>
			<title><![CDATA[[RESOLVED] Recent appearance of error_log in ALL subdirs: "Module 'timezonedb' already loaded"]]></title>
			<link>http://board.phpbuilder.com/showthread.php?10389731-RESOLVED-Recent-appearance-of-error_log-in-ALL-subdirs-quot-Module-timezonedb-already-loaded-quot&amp;goto=newpost</link>
			<pubDate>Fri, 17 May 2013 15:41:01 GMT</pubDate>
			<description><![CDATA[Hi; I have just recently noticed that the error_log files in ALL active subdirectories of my site are adding a new line every single, freakin' time a .php page is called!

Each line reads like so (with the correct time/date):

[16-May-2013 14:13:12 America/Los_Angeles] PHP Warning:  Module 'timezonedb' already loaded in Unknown on line 0

...I have been working on a bunch of new stuff, but this is even happening in old parts of the site that have not been touched.

I contacted the host provider support board and was advised to add the following line to my .htaccess file 

date.timezone = America/Chicago

(I don't think I have ever edited in 5+ years of using this host)

I added that line...which completely disabled my site.  So I found that the apparent correct syntax is actually:

SetEnv TZ America/Chicago

...which allowed my site to work once again (phew!)
The error messages are now conveniently tagged with a correct Central timezone stamp, a la:
[16-May-2013 16:48:36 America/Chicago] PHP Warning:  Module 'timezonedb' already loaded in Unknown on line 0

I am suspecting this has something to do with a bug in the server's installation or configuration of .php (and therefore I will not be able to fix the constant creation of these error messages).  But I am open to suggestion.

If it DOES look like a server-based glitch that the "powers that be" must fix does anybody here know anything specific I can suggest that these folks look at?

Thanks.]]></description>
			<content:encoded><![CDATA[<div>Hi; I have just recently noticed that the error_log files in ALL active subdirectories of my site are adding a new line every single, freakin' time a .php page is called!<br />
<br />
Each line reads like so (with the correct time/date):<br />
<br />
[16-May-2013 14:13:12 America/Los_Angeles] PHP Warning:  Module 'timezonedb' already loaded in Unknown on line 0<br />
<br />
...I have been working on a bunch of new stuff, but this is even happening in old parts of the site that have not been touched.<br />
<br />
I contacted the host provider support board and was advised to add the following line to my .htaccess file <br />
<br />
date.timezone = America/Chicago<br />
<br />
(I don't think I have ever edited in 5+ years of using this host)<br />
<br />
I added that line...which completely disabled my site.  So I found that the apparent correct syntax is actually:<br />
<br />
SetEnv TZ America/Chicago<br />
<br />
...which allowed my site to work once again (phew!)<br />
The error messages are now conveniently tagged with a correct Central timezone stamp, a la:<br />
[16-May-2013 16:48:36 America/Chicago] PHP Warning:  Module 'timezonedb' already loaded in Unknown on line 0<br />
<br />
I am suspecting this has something to do with a bug in the server's installation or configuration of .php (and therefore I will not be able to fix the constant creation of these error messages).  But I am open to suggestion.<br />
<br />
If it DOES look like a server-based glitch that the &quot;powers that be&quot; must fix does anybody here know anything specific I can suggest that these folks look at?<br />
<br />
Thanks.</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?2-General-Help">General Help</category>
			<dc:creator>Joseph Sliker</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389731-RESOLVED-Recent-appearance-of-error_log-in-ALL-subdirs-quot-Module-timezonedb-already-loaded-quot</guid>
		</item>
		<item>
			<title>suggestions for control of cluster nodes by a master node?</title>
			<link>http://board.phpbuilder.com/showthread.php?10389729-suggestions-for-control-of-cluster-nodes-by-a-master-node&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 23:46:02 GMT</pubDate>
			<description><![CDATA[I'm working on a project wherein we need to auto-scale our computing resources in response to a daily batch of tasks.  Basically, the tasks arrive at midnight when a PHP script runs on a web server and inserts a bunch of records in a database table on a shared mysql server.  When these job records have been inserted, I would then like to run another script which interacts with the Rackspace cloud to launch a bunch of virtual server instances to process these jobs. 

My main question is *Can anyone recommend an effective tool or technique for a master PHP script running on my primary web server to monitor and control these newly allocated virtual servers?*

Having thought about this some, I can see that a few types of operations will be necessary:
* once a virtual (slave) server has been launched, hand that slave a unique identifier that it will use to lock records in the job database and then fire up a script on the slave to work on the jobs
* monitor the slaves as they work to keep an eye on load averages, memory usage, job completion rates, and other data related to slave health and performance.
* when the jobs have been completed, de-allocate the slave servers so we save money.

I expect I could do a roll-your-own approach to this but can't help but wonder if some helpful tool already exists that would make this easier.]]></description>
			<content:encoded><![CDATA[<div>I'm working on a project wherein we need to auto-scale our computing resources in response to a daily batch of tasks.  Basically, the tasks arrive at midnight when a PHP script runs on a web server and inserts a bunch of records in a database table on a shared mysql server.  When these job records have been inserted, I would then like to run another script which interacts with the Rackspace cloud to launch a bunch of virtual server instances to process these jobs. <br />
<br />
My main question is <b>Can anyone recommend an effective tool or technique for a master PHP script running on my primary web server to monitor and control these newly allocated virtual servers?</b><br />
<br />
Having thought about this some, I can see that a few types of operations will be necessary:<br />
* once a virtual (slave) server has been launched, hand that slave a unique identifier that it will use to lock records in the job database and then fire up a script on the slave to work on the jobs<br />
* monitor the slaves as they work to keep an eye on load averages, memory usage, job completion rates, and other data related to slave health and performance.<br />
* when the jobs have been completed, de-allocate the slave servers so we save money.<br />
<br />
I expect I could do a roll-your-own approach to this but can't help but wonder if some helpful tool already exists that would make this easier.</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?10-Coding">Coding</category>
			<dc:creator>sneakyimp</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389729-suggestions-for-control-of-cluster-nodes-by-a-master-node</guid>
		</item>
		<item>
			<title>Handling Paypal Buttons While Updating a Database</title>
			<link>http://board.phpbuilder.com/showthread.php?10389725-Handling-Paypal-Buttons-While-Updating-a-Database&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 15:24:13 GMT</pubDate>
			<description><![CDATA[I am testing ideas for a new section of my company's website.  We're doing online magazine subscriptions and I'm trying to find the easiest way to make online renewals automatic.

I have index.html which contains a Paypal button:

Code:
---------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="handler.php" method="post" target="_top">
  <input type="hidden" name="cmd" value="_s-xclick">
  <input type="hidden" name="hosted_button_id" value="5DEAKV4T96HFS">
  <table>
    <tr>
      <td><input type="hidden" name="on0" value="Subscribe or Renew">
        Subscribe or Renew</td>
    </tr>
    <tr>
      <td><select name="os0">
          <option value="New Online Subscription">New Online Subscription $10.00 USD</option>
          <option value="Renewal">Renewal $5.00 USD</option>
        </select></td>
    </tr>
  </table>
  <input type="hidden" name="currency_code" value="USD">
  <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</body>
</html>
---------
Notice that I have changed the form action to "handler.php".  handler.php queries a database to update the customer's subscription expiration date.  So that the customer's subscription will expire one year from the date of renewal.  I know that my code doesn't exactly do this, but it still works for my purpose.  Once again, I'm just testing and playing around.  Here is handler.php:


PHP:
---------
$dbhost = "-------";
$dbname = "-------";
$dbuser = "-------";
$dbpass = "-------";

//Connect to server and select databse.
$con = mysql_connect("$dbhost", "$dbuser", "$dbpass");
if (!con){
	die(mysql_error($con));
}

// Select the database.
mysql_select_db("$dbname", $con);

// Query
$sqlone = "SELECT * FROM test WHERE id='1'";
$result = mysql_query ("$sqlone") or die ('Error: '.mysql_error ());
$result = mysql_fetch_array($result);

$date = $result["date"];
$currentyear = substr("$date",0,4);
$currentmonthday = substr("$date",4,9);
$renewedyear = $currentyear + 1;
$reneweddate = "$renewedyear"."$currentmonthday";

// Update the database
$sqltwo = "UPDATE test SET date='$reneweddate' WHERE id = '1'";
mysql_query ("$sqltwo") or die ('Error: '.mysql_error ());
---------
So, once the paypal button has been clicked, everything goes to handler.php, the database updates correctly, and all of the paypal variables go floating off into space never again to serve any purpose.  How can I restructure this so that my database gets updated and the paypal shopping cart still works?  I thought about passing all the paypal variables to handler.php, but from there how would I pass those variables along to the shopping cart?  Any ideas?  Any suggestions would be greatly appreciated.  Thanks.]]></description>
			<content:encoded><![CDATA[<div>I am testing ideas for a new section of my company's website.  We're doing online magazine subscriptions and I'm trying to find the easiest way to make online renewals automatic.<br />
<br />
I have index.html which contains a Paypal button:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;<br />
&lt;title&gt;Untitled Document&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;form <font color="#FF0000">action=&quot;handler.php&quot;</font> method=&quot;post&quot; target=&quot;_top&quot;&gt;<br />
&nbsp; &lt;input type=&quot;hidden&quot; name=&quot;cmd&quot; value=&quot;_s-xclick&quot;&gt;<br />
&nbsp; &lt;input type=&quot;hidden&quot; name=&quot;hosted_button_id&quot; value=&quot;5DEAKV4T96HFS&quot;&gt;<br />
&nbsp; &lt;table&gt;<br />
&nbsp; &nbsp; &lt;tr&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;td&gt;&lt;input type=&quot;hidden&quot; name=&quot;on0&quot; value=&quot;Subscribe or Renew&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Subscribe or Renew&lt;/td&gt;<br />
&nbsp; &nbsp; &lt;/tr&gt;<br />
&nbsp; &nbsp; &lt;tr&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;td&gt;&lt;select name=&quot;os0&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;option value=&quot;New Online Subscription&quot;&gt;New Online Subscription $10.00 USD&lt;/option&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;option value=&quot;Renewal&quot;&gt;Renewal $5.00 USD&lt;/option&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/select&gt;&lt;/td&gt;<br />
&nbsp; &nbsp; &lt;/tr&gt;<br />
&nbsp; &lt;/table&gt;<br />
&nbsp; &lt;input type=&quot;hidden&quot; name=&quot;currency_code&quot; value=&quot;USD&quot;&gt;<br />
&nbsp; &lt;input type=&quot;image&quot; src=&quot;https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif&quot; border=&quot;0&quot; name=&quot;submit&quot; alt=&quot;PayPal - The safer, easier way to pay online!&quot;&gt;<br />
&nbsp; &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;https://www.paypalobjects.com/en_US/i/scr/pixel.gif&quot; width=&quot;1&quot; height=&quot;1&quot;&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</code><hr />
</div> Notice that I have changed the form action to &quot;handler.php&quot;.  handler.php queries a database to update the customer's subscription expiration date.  So that the customer's subscription will expire one year from the date of renewal.  I know that my code doesn't exactly do this, but it still works for my purpose.  Once again, I'm just testing and playing around.  Here is handler.php:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">$dbhost&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"-------"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$dbname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"-------"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$dbuser&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"-------"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$dbpass&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"-------"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//Connect&nbsp;to&nbsp;server&nbsp;and&nbsp;select&nbsp;databse.<br /></span><span style="color: #0000BB">$con&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$dbhost</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$dbuser</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$dbpass</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />if&nbsp;(!</span><span style="color: #0000BB">con</span><span style="color: #007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;die(</span><span style="color: #0000BB">mysql_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$con</span><span style="color: #007700">));<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;Select&nbsp;the&nbsp;database.<br /></span><span style="color: #0000BB">mysql_select_db</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$dbname</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$con</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Query<br /></span><span style="color: #0000BB">$sqlone&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;test&nbsp;WHERE&nbsp;id='1'"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_query&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$sqlone</span><span style="color: #DD0000">"</span><span style="color: #007700">)&nbsp;or&nbsp;die&nbsp;(</span><span style="color: #DD0000">'Error:&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">mysql_error&nbsp;</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_fetch_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$date&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">"date"</span><span style="color: #007700">&#93;;<br /></span><span style="color: #0000BB">$currentyear&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">substr</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$date</span><span style="color: #DD0000">"</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">4</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$currentmonthday&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">substr</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$date</span><span style="color: #DD0000">"</span><span style="color: #007700">,</span><span style="color: #0000BB">4</span><span style="color: #007700">,</span><span style="color: #0000BB">9</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$renewedyear&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$currentyear&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$reneweddate&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$renewedyear</span><span style="color: #DD0000">"</span><span style="color: #007700">.</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$currentmonthday</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;Update&nbsp;the&nbsp;database<br /></span><span style="color: #0000BB">$sqltwo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"UPDATE&nbsp;test&nbsp;SET&nbsp;date='</span><span style="color: #0000BB">$reneweddate</span><span style="color: #DD0000">'&nbsp;WHERE&nbsp;id&nbsp;=&nbsp;'1'"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">mysql_query&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$sqltwo</span><span style="color: #DD0000">"</span><span style="color: #007700">)&nbsp;or&nbsp;die&nbsp;(</span><span style="color: #DD0000">'Error:&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">mysql_error&nbsp;</span><span style="color: #007700">());&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div> So, once the paypal button has been clicked, everything goes to handler.php, the database updates correctly, and all of the paypal variables go floating off into space never again to serve any purpose.  How can I restructure this so that my database gets updated and the paypal shopping cart still works?  I thought about passing all the paypal variables to handler.php, but from there how would I pass those variables along to the shopping cart?  Any ideas?  Any suggestions would be greatly appreciated.  Thanks.</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?10-Coding">Coding</category>
			<dc:creator>sgrd267</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389725-Handling-Paypal-Buttons-While-Updating-a-Database</guid>
		</item>
		<item>
			<title>Possible to add text to an image... and save the image, not just overlay?</title>
			<link>http://board.phpbuilder.com/showthread.php?10389723-Possible-to-add-text-to-an-image...-and-save-the-image-not-just-overlay&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 06:23:53 GMT</pubDate>
			<description><![CDATA[I am trying to write permanent text on an image, I've found a GD way to overlay text, but it doesn't actually write the text to the actual photo file, which is what I am hoping to be able to do... is this possible?]]></description>
			<content:encoded><![CDATA[<div>I am trying to write permanent text on an image, I've found a GD way to overlay text, but it doesn't actually write the text to the actual photo file, which is what I am hoping to be able to do... is this possible?</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?10-Coding">Coding</category>
			<dc:creator>listenmirndt</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389723-Possible-to-add-text-to-an-image...-and-save-the-image-not-just-overlay</guid>
		</item>
		<item>
			<title>Trying to write a comment system, please give thoughts.</title>
			<link>http://board.phpbuilder.com/showthread.php?10389721-Trying-to-write-a-comment-system-please-give-thoughts.&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 03:21:52 GMT</pubDate>
			<description><![CDATA[Alright, I have ventured out and attempted to write this code 100% myself. The problem is everything was working just fine until I tried to implement a reply system.  This code would probably make a real PHP developer disgusted, I know there is probably an easier/more logical way to do this but from my knowledge this is the only way I know how to go about doing this. 

What is your feedback? 





PHP:
---------
<?php 
//Get Comments From Database
$comments = mysql_query("SELECT id,user,comment,avatar FROM comments WHERE commentpage='$youtubeid' ") or die(mysql_error());

if (!$comments) {  //Retrieve Comments
		exit;
	}else{

	while ($commentrow = mysql_fetch_row($comments)){
	$comment_id = $commentrow['0']; //Get Comment ID
	$comment_user = $commentrow['1']; //Get Comment Author
	$comment_message= $commentrow['2']; //Get Comment Message
	$comment_avatar = $commentrow['3']; //Get Comment Avatar
	
	
$replies = mysql_query("SELECT user,comment,avatar FROM comments WHERE reply='$comment_id' ") or die(mysql_error());
if (!$replies) {  //Retrieve Reply Comments
		exit;
	}else{

	while ($commentreplyrow = mysql_fetch_row($replies)){
	$comment_replyuser = $commentreplyrow ['0']; //Get Reply Comment Author
	$comment_replymessage= $commentreplyrow ['1']; //Get Reply Comment Message
	$comment_replyavatar = $commentreplyrow ['2']; //Get Reply Comment Avatar
	

	
         echo $comment_user.'<br>'; //This is just for testing. I will make this look pretty after I get further in development.
	 echo $comment_message .'<br><br>';

          echo $comment_replyuser.'<br>';
	 echo $comment_replymessage.'<br>';
	
	}
	}
	}
	}
?>
---------
]]></description>
			<content:encoded><![CDATA[<div>Alright, I have ventured out and attempted to write this code 100% myself. The problem is everything was working just fine until I tried to implement a reply system.  This code would probably make a real PHP developer disgusted, I know there is probably an easier/more logical way to do this but from my knowledge this is the only way I know how to go about doing this. <br />
<br />
What is your feedback? <br />
<br />
<br />
<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;<br /></span><span style="color: #FF8000">//Get&nbsp;Comments&nbsp;From&nbsp;Database<br /></span><span style="color: #0000BB">$comments&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;id,user,comment,avatar&nbsp;FROM&nbsp;comments&nbsp;WHERE&nbsp;commentpage='</span><span style="color: #0000BB">$youtubeid</span><span style="color: #DD0000">'&nbsp;"</span><span style="color: #007700">)&nbsp;or&nbsp;die(</span><span style="color: #0000BB">mysql_error</span><span style="color: #007700">());<br /><br />if&nbsp;(!</span><span style="color: #0000BB">$comments</span><span style="color: #007700">)&nbsp;{&nbsp;&nbsp;</span><span style="color: #FF8000">//Retrieve&nbsp;Comments<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;}else{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(</span><span style="color: #0000BB">$commentrow&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$comments</span><span style="color: #007700">)){<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$comment_id&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$commentrow</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'0'</span><span style="color: #007700">&#93;;&nbsp;</span><span style="color: #FF8000">//Get&nbsp;Comment&nbsp;ID<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$comment_user&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$commentrow</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'1'</span><span style="color: #007700">&#93;;&nbsp;</span><span style="color: #FF8000">//Get&nbsp;Comment&nbsp;Author<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$comment_message</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$commentrow</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'2'</span><span style="color: #007700">&#93;;&nbsp;</span><span style="color: #FF8000">//Get&nbsp;Comment&nbsp;Message<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$comment_avatar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$commentrow</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'3'</span><span style="color: #007700">&#93;;&nbsp;</span><span style="color: #FF8000">//Get&nbsp;Comment&nbsp;Avatar<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">$replies&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;user,comment,avatar&nbsp;FROM&nbsp;comments&nbsp;WHERE&nbsp;reply='</span><span style="color: #0000BB">$comment_id</span><span style="color: #DD0000">'&nbsp;"</span><span style="color: #007700">)&nbsp;or&nbsp;die(</span><span style="color: #0000BB">mysql_error</span><span style="color: #007700">());<br />if&nbsp;(!</span><span style="color: #0000BB">$replies</span><span style="color: #007700">)&nbsp;{&nbsp;&nbsp;</span><span style="color: #FF8000">//Retrieve&nbsp;Reply&nbsp;Comments<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;}else{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(</span><span style="color: #0000BB">$commentreplyrow&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$replies</span><span style="color: #007700">)){<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$comment_replyuser&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$commentreplyrow&nbsp;</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'0'</span><span style="color: #007700">&#93;;&nbsp;</span><span style="color: #FF8000">//Get&nbsp;Reply&nbsp;Comment&nbsp;Author<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$comment_replymessage</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$commentreplyrow&nbsp;</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'1'</span><span style="color: #007700">&#93;;&nbsp;</span><span style="color: #FF8000">//Get&nbsp;Reply&nbsp;Comment&nbsp;Message<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$comment_replyavatar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$commentreplyrow&nbsp;</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'2'</span><span style="color: #007700">&#93;;&nbsp;</span><span style="color: #FF8000">//Get&nbsp;Reply&nbsp;Comment&nbsp;Avatar<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$comment_user</span><span style="color: #007700">.</span><span style="color: #DD0000">'&lt;br&gt;'</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//This&nbsp;is&nbsp;just&nbsp;for&nbsp;testing.&nbsp;I&nbsp;will&nbsp;make&nbsp;this&nbsp;look&nbsp;pretty&nbsp;after&nbsp;I&nbsp;get&nbsp;further&nbsp;in&nbsp;development.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$comment_message&nbsp;</span><span style="color: #007700">.</span><span style="color: #DD0000">'&lt;br&gt;&lt;br&gt;'</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$comment_replyuser</span><span style="color: #007700">.</span><span style="color: #DD0000">'&lt;br&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$comment_replymessage</span><span style="color: #007700">.</span><span style="color: #DD0000">'&lt;br&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?10-Coding">Coding</category>
			<dc:creator>JustCoding</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389721-Trying-to-write-a-comment-system-please-give-thoughts.</guid>
		</item>
		<item>
			<title>List of special character</title>
			<link>http://board.phpbuilder.com/showthread.php?10389719-List-of-special-character&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 21:12:54 GMT</pubDate>
			<description><![CDATA[Hello,

I am developing a simple form to collect user information. I want a sample PHP code, that will validate the input string to display whether it has any of the below list of special character in the string.

Special Characters ( - & ' " / \ % * # )

Can one of please help me. More detailed info below:

I have a form that submits the input to a PHP modules using Ajax Post. When my PHP modules reads the POST values, it should validate to check if the special characters are available, if it is available then display "No special characters allowed"


Anyones help will be so greatful

Thank you.]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am developing a simple form to collect user information. I want a sample PHP code, that will validate the input string to display whether it has any of the below list of special character in the string.<br />
<br />
Special Characters ( - &amp; ' &quot; / \ % * # )<br />
<br />
Can one of please help me. More detailed info below:<br />
<br />
I have a form that submits the input to a PHP modules using Ajax Post. When my PHP modules reads the POST values, it should validate to check if the special characters are available, if it is available then display &quot;No special characters allowed&quot;<br />
<br />
<br />
Anyones help will be so greatful<br />
<br />
Thank you.</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>DanDin</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389719-List-of-special-character</guid>
		</item>
		<item>
			<title>Iterate through JSON data like a multi-d array?/Show all fields/vals for clicked row?</title>
			<link>http://board.phpbuilder.com/showthread.php?10389717-Iterate-through-JSON-data-like-a-multi-d-array-Show-all-fields-vals-for-clicked-row&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 18:30:45 GMT</pubDate>
			<description><![CDATA[Hi;  My head hurts.  I am not _quite_ getting this JSON object stuff.

Three goals here:
1. Run a MySQL query and return the results in JSON
(I can do this...it seems to work fine) 

2. show a table that shows short/summary CLICKABLE record rows (that show just a couple of the fields for each of the JSON rows/elements) ...
(I've actually figured out this first part and it seems to work fine)

3. The result of clicking on a specific row (in the table refered to above) results a display in a table/form being shown that will show ALL fields/values for that specific, clicked record.
When I click a row, the row ID _does_ magically appear in the <span> tags located above the summary table.
(THIS IS WHERE I AM STUCK...instead of just seeing that number, I want to see all available details for that specific record/row)

[I can do all of this stuff in php with sessions, and arrays and forms and all that good stuff...but I would like to understand how to do this in javascript/client-side in order to make use of the page more efficient]

Here is the code that seems to be working fine to accomplish steps 1 and 2.
My offerdata.js file:

Code:
---------
$(document).ready(function() {	
$.getJSON('offerdata.php', function(data) {//a summary table that shows, say, 4 out of 12 fields that exist in JSON for each row
      var table='<table>'; 
      	 table+='<tr><th>OFFER_ID</th><th>PROPERTY</th><th>STAFF</th><th>OFFER_STATUS</th></tr><tbody class="hrow">';   
      $.each(data, function(index, item){
	 table+='<tr valign="top"onclick="selectRow(this)" id="'+index+'"><td>'+item.OFFER_ID+'</td><td>'+item.PROPERTY+'</td><td>'+item.STAFF+'</td><td>'+item.OFFER_STATUS+'</td></tr>';
       });
      table+='</tbody></table>';
      $("#content").html(table);	//refer to this id in <table> tags back at the page 
});	
});
---------
and back in the <body> of the page, I have this:

HTML:
---------
<span id="offer_id"></span><hr />
<!-- I would like to have a details table to appear here when any row is clicked (all details for that row)  ie. for each field that exists in the JSON for that selected row <tr><th>$fld</th><td>$val</td></tr> --->
<table id="content"></table>
---------
I am assuming, because I _CAN_ see my summary table, that the complete JSON array (object?) remains available to populate the details table I would like to be able to display.

Somebody give me a nudge in the right direction?

Thanks.]]></description>
			<content:encoded><![CDATA[<div>Hi;  My head hurts.  I am not _quite_ getting this JSON object stuff.<br />
<br />
Three goals here:<br />
1. Run a MySQL query and return the results in JSON<br />
(I can do this...it seems to work fine) <br />
<br />
2. show a table that shows short/summary CLICKABLE record rows (that show just a couple of the fields for each of the JSON rows/elements) ...<br />
(I've actually figured out this first part and it seems to work fine)<br />
<br />
3. The result of clicking on a specific row (in the table refered to above) results a display in a table/form being shown that will show ALL fields/values for that specific, clicked record.<br />
When I click a row, the row ID _does_ magically appear in the &lt;span&gt; tags located above the summary table.<br />
(THIS IS WHERE I AM STUCK...instead of just seeing that number, I want to see all available details for that specific record/row)<br />
<br />
[I can do all of this stuff in php with sessions, and arrays and forms and all that good stuff...but I would like to understand how to do this in javascript/client-side in order to make use of the page more efficient]<br />
<br />
Here is the code that seems to be working fine to accomplish steps 1 and 2.<br />
My offerdata.js file:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">$(document).ready(function() {&nbsp; &nbsp; &nbsp; &nbsp; <br />
$.getJSON('offerdata.php', function(data) {//a summary table that shows, say, 4 out of 12 fields that exist in JSON for each row<br />
&nbsp; &nbsp; &nbsp; var table='&lt;table&gt;'; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  table+='&lt;tr&gt;&lt;th&gt;OFFER_ID&lt;/th&gt;&lt;th&gt;PROPERTY&lt;/th&gt;&lt;th&gt;STAFF&lt;/th&gt;&lt;th&gt;OFFER_STATUS&lt;/th&gt;&lt;/tr&gt;&lt;tbody class=&quot;hrow&quot;&gt;';&nbsp;  <br />
&nbsp; &nbsp; &nbsp; $.each(data, function(index, item){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  table+='&lt;tr valign=&quot;top&quot;onclick=&quot;selectRow(this)&quot; id=&quot;'+index+'&quot;&gt;&lt;td&gt;'+item.OFFER_ID+'&lt;/td&gt;&lt;td&gt;'+item.PROPERTY+'&lt;/td&gt;&lt;td&gt;'+item.STAFF+'&lt;/td&gt;&lt;td&gt;'+item.OFFER_STATUS+'&lt;/td&gt;&lt;/tr&gt;';<br />
&nbsp; &nbsp; &nbsp;  });<br />
&nbsp; &nbsp; &nbsp; table+='&lt;/tbody&gt;&lt;/table&gt;';<br />
&nbsp; &nbsp; &nbsp; $(&quot;#content&quot;).html(table);&nbsp; &nbsp; &nbsp; &nbsp; //refer to this id in &lt;table&gt; tags back at the page <br />
});&nbsp; &nbsp; &nbsp; &nbsp; <br />
});</code><hr />
</div> and back in the &lt;body&gt; of the page, I have this:<br />
<div class="bbcode_container">
	<div class="bbcode_description">HTML Code:</div>
	<hr /><code class="bbcode_code"><span style="color:#000080">&lt;span id=<span style="color:#0000FF">&quot;offer_id&quot;</span>&gt;</span><span style="color:#000080">&lt;/span&gt;</span><span style="color:#000080">&lt;hr /&gt;</span><br />
<i><span style="color:#000080">&lt;!-- I would like to have a details table to appear here when any row is clicked (all details for that row)&nbsp; ie. for each field that exists in the JSON for that selected row &lt;tr&gt;</span><span style="color:#008080">&lt;th&gt;</span>$fld<span style="color:#008080">&lt;/th&gt;</span><span style="color:#008080">&lt;td&gt;</span>$val<span style="color:#008080">&lt;/td&gt;</span><span style="color:#008080">&lt;/tr&gt;</span> ---&gt;</i><br />
<span style="color:#008080">&lt;table id=<span style="color:#0000FF">&quot;content&quot;</span>&gt;</span><span style="color:#008080">&lt;/table&gt;</span></code><hr />
</div> I am assuming, because I _CAN_ see my summary table, that the complete JSON array (object?) remains available to populate the details table I would like to be able to display.<br />
<br />
Somebody give me a nudge in the right direction?<br />
<br />
Thanks.</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?27-ClientSide-Technologies">ClientSide Technologies</category>
			<dc:creator>Joseph Sliker</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389717-Iterate-through-JSON-data-like-a-multi-d-array-Show-all-fields-vals-for-clicked-row</guid>
		</item>
		<item>
			<title>displaying data on a page with databases</title>
			<link>http://board.phpbuilder.com/showthread.php?10389715-displaying-data-on-a-page-with-databases&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 12:20:03 GMT</pubDate>
			<description><![CDATA[Hi,

I am at the next stage of learning and so far I have a simple select statement working with PDO as illustrated below.  This works fine if you want a list of things or just one thing:

What if, for example I had lets say four products on one page with headings but each product is a different level:

bronze  |  silver  |  gold   |  platinum

Try to imagine that they have similar services but just more of, when you select the higher package.

I am not looking for anyone to write the code for me, just steer me in the right direction.

Here is my code so far which works for one thing.


PHP:
---------


$book_query = ("SELECT * FROM packages WHERE service = ? LIMIT 10"); 
if(!$book_stmt = $pdo->prepare($host_query)){ 
    // prepare failed 
    echo "<pre>Prepare failed:\n"; 
    print_r($pdo->errorInfo()); 
    echo "</pre>"; 
} else { 
    if(!$book_stmt->execute(array('books'))){ 
        // execute failed 
        echo "<pre>Execute failed:\n"; 
        print_r($book_stmt->errorInfo()); 
        echo "</pre>"; 
    } else { 
        // query ran without any errors, you can test if it returned any rows and use them here 
         
    } 
} 
// Database   

if ($book_stmt->rowCount() > 0) {
while ($col = $book_stmt->fetch(PDO::FETCH_ASSOC)) {  
    $title = $col['title']; 
    $author = $col['author']; 
    $descr = $col[''description]; 
    $type = $col['type']; 
    $language = $col['language']; 
    $paperback = $col['paperback']; 
    $currency = $col['currency']; 
    $price = $col['price']; 
     

    } 

} else { 

    $title = 'no data'; 
    $author = 'no data'; 
    $descr = 'no data'; 
    $type = 'no data'; 
    $language = 'no data'; 
    $paperback = 'no data'; 
    $currency = 'no data'; 
    $price = 'no data'; 

}
---------

I hope what i am trying to achieve is clear.  Any help will be great ;)]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am at the next stage of learning and so far I have a simple select statement working with PDO as illustrated below.  This works fine if you want a list of things or just one thing:<br />
<br />
What if, for example I had lets say four products on one page with headings but each product is a different level:<br />
<br />
bronze  |  silver  |  gold   |  platinum<br />
<br />
Try to imagine that they have similar services but just more of, when you select the higher package.<br />
<br />
I am not looking for anyone to write the code for me, just steer me in the right direction.<br />
<br />
Here is my code so far which works for one thing.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB"><br /><br />$book_query&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;packages&nbsp;WHERE&nbsp;service&nbsp;=&nbsp;?&nbsp;LIMIT&nbsp;10"</span><span style="color: #007700">);&nbsp;<br />if(!</span><span style="color: #0000BB">$book_stmt&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$pdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$host_query</span><span style="color: #007700">)){&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;prepare&nbsp;failed&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"&lt;pre&gt;Prepare&nbsp;failed:\n"</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$pdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">errorInfo</span><span style="color: #007700">());&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;/pre&gt;"</span><span style="color: #007700">;&nbsp;<br />}&nbsp;else&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;if(!</span><span style="color: #0000BB">$book_stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'books'</span><span style="color: #007700">))){&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;execute&nbsp;failed&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"&lt;pre&gt;Execute&nbsp;failed:\n"</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$book_stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">errorInfo</span><span style="color: #007700">());&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;/pre&gt;"</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;query&nbsp;ran&nbsp;without&nbsp;any&nbsp;errors,&nbsp;you&nbsp;can&nbsp;test&nbsp;if&nbsp;it&nbsp;returned&nbsp;any&nbsp;rows&nbsp;and&nbsp;use&nbsp;them&nbsp;here&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">}&nbsp;<br />}&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;Database&nbsp;&nbsp;&nbsp;<br /><br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">$book_stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rowCount</span><span style="color: #007700">()&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />while&nbsp;(</span><span style="color: #0000BB">$col&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$book_stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fetch</span><span style="color: #007700">(</span><span style="color: #0000BB">PDO</span><span style="color: #007700">::</span><span style="color: #0000BB">FETCH_ASSOC</span><span style="color: #007700">))&nbsp;{&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'title'</span><span style="color: #007700">&#93;;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$author&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'author'</span><span style="color: #007700">&#93;;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$descr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">''</span><span style="color: #0000BB">description</span><span style="color: #007700">&#93;;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'type'</span><span style="color: #007700">&#93;;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$language&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'language'</span><span style="color: #007700">&#93;;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$paperback&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'paperback'</span><span style="color: #007700">&#93;;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$currency&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'currency'</span><span style="color: #007700">&#93;;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$price&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'price'</span><span style="color: #007700">&#93;;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br /><br />}&nbsp;else&nbsp;{&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$author&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$descr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$language&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$paperback&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$currency&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$price&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;&nbsp;<br /><br />}&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div> <br />
I hope what i am trying to achieve is clear.  Any help will be great ;)</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?2-General-Help">General Help</category>
			<dc:creator>chrisguk</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389715-displaying-data-on-a-page-with-databases</guid>
		</item>
		<item>
			<title>Formatting text file</title>
			<link>http://board.phpbuilder.com/showthread.php?10389713-Formatting-text-file&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 08:41:17 GMT</pubDate>
			<description>Hi!
i have some data exactly as below:

Code:
---------
country 
town
monument

france
paris
eiffel

usa
newyork
manatthan
...
---------
I need to format as below:

Code:
---------
country town monument
france paris eiffel
usa newyork manatthan
---------
How can I obtain this result?

Thanks!</description>
			<content:encoded><![CDATA[<div>Hi!<br />
i have some data exactly as below:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">country <br />
town<br />
monument<br />
<br />
france<br />
paris<br />
eiffel<br />
<br />
usa<br />
newyork<br />
manatthan<br />
...</code><hr />
</div> I need to format as below:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">country town monument<br />
france paris eiffel<br />
usa newyork manatthan</code><hr />
</div> How can I obtain this result?<br />
<br />
Thanks!</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?10-Coding">Coding</category>
			<dc:creator>joane1</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389713-Formatting-text-file</guid>
		</item>
		<item>
			<title>Query with joins, count()s and sum() producing odd results</title>
			<link>http://board.phpbuilder.com/showthread.php?10389711-Query-with-joins-count()s-and-sum()-producing-odd-results&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 01:22:31 GMT</pubDate>
			<description><![CDATA[Well, probably not "odd" - much more likely bad SQL on my part.

I'm attempting to get a list of all customers, and get each customer's count of orders from the order table, count of cart items from the cart items table, and sum of store credit from the credits table.

=====================================

SELECT c.*, SUM(sc.amount) AS creditTotal, COUNT(o.orderId) AS orders, MAX(o.orderDate) AS lastOrder FROM customers c LEFT JOIN storeCredits sc ON c.customerId=sc.customerId LEFT JOIN orders o ON c.customerId=o.customerId GROUP BY c.customerId ORDER BY c.lastName ASC 

This gets me an "orders" count of 4 for my second customer, which is correct. But when I join cartItems to the query I get an orders count of 8, and a cartItemCount of 8 (should be 2).

SELECT c.*, SUM(sc.amount) AS creditTotal, COUNT(o.orderId) AS orders, MAX(o.orderDate) AS lastOrder, COUNT(ci.cartItemId) AS cartItemCount FROM customers c LEFT JOIN storeCredits sc ON c.customerId=sc.customerId LEFT JOIN orders o ON c.customerId=o.customerId LEFT JOIN cartItems ci ON c.customerId=ci.customerId GROUP BY c.customerId ORDER BY c.lastName ASC 

It's definitely adding the last LEFT JOIN that's messing things up, not adding to the SELECT statement. It seems to be multiplying the COUNT items within the query by each other (4 x 2) instead of keeping them isolated and separate.

Any tips?]]></description>
			<content:encoded><![CDATA[<div>Well, probably not &quot;odd&quot; - much more likely bad SQL on my part.<br />
<br />
I'm attempting to get a list of all customers, and get each customer's count of orders from the order table, count of cart items from the cart items table, and sum of store credit from the credits table.<br />
<br />
=====================================<br />
<br />
SELECT c.*, SUM(sc.amount) AS creditTotal, COUNT(o.orderId) AS orders, MAX(o.orderDate) AS lastOrder FROM customers c LEFT JOIN storeCredits sc ON c.customerId=sc.customerId LEFT JOIN orders o ON c.customerId=o.customerId GROUP BY c.customerId ORDER BY c.lastName ASC <br />
<br />
This gets me an &quot;orders&quot; count of 4 for my second customer, which is correct. But when I join cartItems to the query I get an orders count of 8, and a cartItemCount of 8 (should be 2).<br />
<br />
SELECT c.*, SUM(sc.amount) AS creditTotal, COUNT(o.orderId) AS orders, MAX(o.orderDate) AS lastOrder, COUNT(ci.cartItemId) AS cartItemCount FROM customers c LEFT JOIN storeCredits sc ON c.customerId=sc.customerId LEFT JOIN orders o ON c.customerId=o.customerId LEFT JOIN cartItems ci ON c.customerId=ci.customerId GROUP BY c.customerId ORDER BY c.lastName ASC <br />
<br />
It's definitely adding the last LEFT JOIN that's messing things up, not adding to the SELECT statement. It seems to be multiplying the COUNT items within the query by each other (4 x 2) instead of keeping them isolated and separate.<br />
<br />
Any tips?</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?6-Database">Database</category>
			<dc:creator>bunner bob</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389711-Query-with-joins-count()s-and-sum()-producing-odd-results</guid>
		</item>
		<item>
			<title><![CDATA["Interprocess" communication and serialized data ...]]></title>
			<link>http://board.phpbuilder.com/showthread.php?10389707-quot-Interprocess-quot-communication-and-serialized-data-...&amp;goto=newpost</link>
			<pubDate>Tue, 14 May 2013 20:45:48 GMT</pubDate>
			<description><![CDATA[I'm working on another stage of a large project at work.

After munging some data objects, one process needs to "queue it up" for another to be run at a later time.

Currently I'm thinking to serialize the data and pop it in a table with a couple additional tagging fields.

Something like:


Code:
---------
+------------+-------------+------+-----+---------+----------------+
| Field      | Type        | Null | Key | Default | Extra          |
+------------+-------------+------+-----+---------+----------------+
| id         | int(11)     | NO   | PRI | NULL    | auto_increment |
| clientid   | int(11)     | NO   | MUL | NULL    |                |
| ordernum   | varchar(64) | NO   |     | NULL    |                |
| t_package  | mediumblob  | NO   |     | NULL    |                |
+------------+-------------+------+-----+---------+----------------+
---------
Is there any reason I shouldn't do it this way?  Some other system?  I really want to keep the object in its previous state, but can't hand it off to the next process immediately.

Thanks in advance,]]></description>
			<content:encoded><![CDATA[<div>I'm working on another stage of a large project at work.<br />
<br />
After munging some data objects, one process needs to &quot;queue it up&quot; for another to be run at a later time.<br />
<br />
Currently I'm thinking to serialize the data and pop it in a table with a couple additional tagging fields.<br />
<br />
Something like:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">+------------+-------------+------+-----+---------+----------------+<br />
| Field&nbsp; &nbsp; &nbsp; | Type&nbsp; &nbsp; &nbsp; &nbsp; | Null | Key | Default | Extra&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br />
+------------+-------------+------+-----+---------+----------------+<br />
| id&nbsp; &nbsp; &nbsp; &nbsp;  | int(11)&nbsp; &nbsp;  | NO&nbsp;  | PRI | NULL&nbsp; &nbsp; | auto_increment |<br />
| clientid&nbsp;  | int(11)&nbsp; &nbsp;  | NO&nbsp;  | MUL | NULL&nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br />
| ordernum&nbsp;  | varchar(64) | NO&nbsp;  |&nbsp; &nbsp;  | NULL&nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br />
| t_package&nbsp; | mediumblob&nbsp; | NO&nbsp;  |&nbsp; &nbsp;  | NULL&nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br />
+------------+-------------+------+-----+---------+----------------+</code><hr />
</div> Is there any reason I shouldn't do it this way?  Some other system?  I really want to keep the object in its previous state, but can't hand it off to the next process immediately.<br />
<br />
Thanks in advance,</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?10-Coding">Coding</category>
			<dc:creator>dalecosp</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389707-quot-Interprocess-quot-communication-and-serialized-data-...</guid>
		</item>
		<item>
			<title>Help with setting page size</title>
			<link>http://board.phpbuilder.com/showthread.php?10389705-Help-with-setting-page-size&amp;goto=newpost</link>
			<pubDate>Tue, 14 May 2013 18:47:13 GMT</pubDate>
			<description><![CDATA[Hi, hope someone can help.
I either need a very simple 'set page size' so the "echo" page isn't too large for the table it appears in or somehow change dimensions somewhere.
I am using a PHP form, where people type in the fields in feedback.php, and when they submit, it parses to sendemail.php with the following response:

Thanks for your<br> entry <?php echo $visitor ?>. Good luck!

(I am all a bit new to this so I apologise, especially if my terminology usage is out.)

Unfortunately, as the image below shows (comparing the before and after sumbission), the sendemail.php is taking up too much space in the rounded table.  It's for a facebook app I am trying to build.  

Attachment 4889 (http://board.phpbuilder.com/attachment.php?attachmentid=4889)]]></description>
			<content:encoded><![CDATA[<div>Hi, hope someone can help.<br />
I either need a very simple 'set page size' so the &quot;echo&quot; page isn't too large for the table it appears in or somehow change dimensions somewhere.<br />
I am using a PHP form, where people type in the fields in feedback.php, and when they submit, it parses to sendemail.php with the following response:<br />
<br />
Thanks for your&lt;br&gt; entry &lt;?php echo $visitor ?&gt;. Good luck!<br />
<br />
(I am all a bit new to this so I apologise, especially if my terminology usage is out.)<br />
<br />
Unfortunately, as the image below shows (comparing the before and after sumbission), the sendemail.php is taking up too much space in the rounded table.  It's for a facebook app I am trying to build.  <br />
<br />
<a href="http://board.phpbuilder.com/attachment.php?attachmentid=4889"  title="Name:  
Views: 
Size:  ">Attachment 4889</a></div>


	<div style="padding:10px">

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
			<ul>
			<li>
	<img class="inlineimg" src="/jpg.gif" alt="File Type: jpg" />
	<a href="http://board.phpbuilder.com/attachment.php?attachmentid=4889&amp;d=1368557150" target="_blank">error.jpg&lrm;</a> 
(37.6 KB)
</li> 
			</ul>
			</fieldset>
	

	

	</div>
 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?27-ClientSide-Technologies">ClientSide Technologies</category>
			<dc:creator>Mike_ZA</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389705-Help-with-setting-page-size</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] Row 10 no displaying]]></title>
			<link>http://board.phpbuilder.com/showthread.php?10389703-RESOLVED-Row-10-no-displaying&amp;goto=newpost</link>
			<pubDate>Tue, 14 May 2013 15:05:26 GMT</pubDate>
			<description><![CDATA[I hopefully seem to be getting somewhere from my last post about creating a database script.  But now I seem to be getting an error with the following:


Code:
---------
Notice: Undefined offset: 10 in /var/www/mysite/include/config.php on line 126
---------
So its this *line 126* that the output will not produce:


Code:
---------
 $price = $col[10];
---------
I ran the query in phpmyadmin to make sure it was working:

SQL result

Host: localhost
Database: mydb
Generation Time: May 14, 2013 at 04:56 PM
Generated by: phpMyAdmin 3.5.8.1deb1 / MySQL 5.5.31-0ubuntu0.13.04.1
SQL query: SELECT * FROM packages WHERE service = 'books' LIMIT 1; 
Rows: 1

service	plan	  title	author descr type language paperback currency price
books 	weekly a	b	  c	  d     e            f             g            h

Here is the code:


PHP:
---------

$book_query = ("SELECT * FROM packages WHERE service = ? LIMIT 1");
if(!$book_stmt = $pdo->prepare($host_query)){
    // prepare failed
    echo "<pre>Prepare failed:\n";
    print_r($pdo->errorInfo());
    echo "</pre>";
} else {
    if(!$book_stmt->execute(array('books'))){
        // execute failed
        echo "<pre>Execute failed:\n";
        print_r($book_stmt->errorInfo());
        echo "</pre>";
    } else {
        // query ran without any errors, you can test if it returned any rows and use them here
        
    }
}
// Database  

if ($book_stmt->rowCount() > 0) {
    while ($col = $book_stmt->fetch())
    {
    $title = $col[3];
    $author = $col[4];
    $descr = $col[5];
    $type = $col[6];
    $language = $col[7];
    $paperback = $col[8];
    $currency = $col[9];
    $price = $col[10];
    

    }

} else {

    $title = 'no data';
    $author = 'no data';
    $descr = 'no data';
    $type = 'no data';
    $language = 'no data';
    $paperback = 'no data';
    $currency = 'no data';
    $price = 'no data';

}
---------


What can I do to correct this?]]></description>
			<content:encoded><![CDATA[<div>I hopefully seem to be getting somewhere from my last post about creating a database script.  But now I seem to be getting an error with the following:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Notice: Undefined offset: 10 in /var/www/mysite/include/config.php on line 126</code><hr />
</div> So its this <b>line 126</b> that the output will not produce:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"> $price = $col[10];</code><hr />
</div> I ran the query in phpmyadmin to make sure it was working:<br />
<br />
SQL result<br />
<br />
Host: localhost<br />
Database: mydb<br />
Generation Time: May 14, 2013 at 04:56 PM<br />
Generated by: phpMyAdmin 3.5.8.1deb1 / MySQL 5.5.31-0ubuntu0.13.04.1<br />
SQL query: SELECT * FROM packages WHERE service = 'books' LIMIT 1; <br />
Rows: 1<br />
<br />
service	plan	  title	author descr type language paperback currency price<br />
books 	weekly a	b	  c	  d     e            f             g            h<br />
<br />
Here is the code:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB"><br />$book_query&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;packages&nbsp;WHERE&nbsp;service&nbsp;=&nbsp;?&nbsp;LIMIT&nbsp;1"</span><span style="color: #007700">);<br />if(!</span><span style="color: #0000BB">$book_stmt&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$pdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$host_query</span><span style="color: #007700">)){<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;prepare&nbsp;failed<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"&lt;pre&gt;Prepare&nbsp;failed:\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$pdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">errorInfo</span><span style="color: #007700">());<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;/pre&gt;"</span><span style="color: #007700">;<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if(!</span><span style="color: #0000BB">$book_stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'books'</span><span style="color: #007700">))){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;execute&nbsp;failed<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"&lt;pre&gt;Execute&nbsp;failed:\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$book_stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">errorInfo</span><span style="color: #007700">());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;/pre&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;query&nbsp;ran&nbsp;without&nbsp;any&nbsp;errors,&nbsp;you&nbsp;can&nbsp;test&nbsp;if&nbsp;it&nbsp;returned&nbsp;any&nbsp;rows&nbsp;and&nbsp;use&nbsp;them&nbsp;here<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">}<br />}<br /></span><span style="color: #FF8000">//&nbsp;Database&nbsp;&nbsp;<br /><br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">$book_stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rowCount</span><span style="color: #007700">()&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(</span><span style="color: #0000BB">$col&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$book_stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fetch</span><span style="color: #007700">())<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">3</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$author&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">4</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$descr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">5</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">6</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$language&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">7</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$paperback&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">8</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$currency&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">9</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$price&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$col</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">10</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />}&nbsp;else&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$author&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$descr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$language&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$paperback&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$currency&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$price&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;data'</span><span style="color: #007700">;<br /><br />}&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div> <br />
<br />
What can I do to correct this?</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?6-Database">Database</category>
			<dc:creator>chrisguk</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389703-RESOLVED-Row-10-no-displaying</guid>
		</item>
		<item>
			<title>Is my select statement secure enough?</title>
			<link>http://board.phpbuilder.com/showthread.php?10389701-Is-my-select-statement-secure-enough&amp;goto=newpost</link>
			<pubDate>Mon, 13 May 2013 14:37:20 GMT</pubDate>
			<description><![CDATA[I have thrown together the following, with a few snippets pulled from various places.  Is it ok to use without the worry of sql injection?


PHP:
---------

try {
  // Connect and create the PDO object
  $conn = new PDO("mysql:host=$hostdb; dbname=$namedb", $userdb, $passdb);
  $conn->exec("SET CHARACTER SET utf8");      // Sets encoding UTF-8

  // Define and perform the SQL SELECT query
  $sql = "SELECT * FROM `db_linux`";
  $result = $conn->query($sql);

  // If the SQL query is successfully performed ($result not false)
  if($result !== false) {
    $cols = $result->columnCount();           // Number of returned columns

    // Parse the result set
   if ($sql->num_rows > 0) {
    while ($row = $sql->fetch_object())
    {
        $plan = $row->plan;
        $name = $row->name;
        $text = $row->text;

    }

} else {

    
    $plan = 'no plan';
    $name = 'NA';
    $text = 'NA2';

} 
    
    
  }
---------
]]></description>
			<content:encoded><![CDATA[<div>I have thrown together the following, with a few snippets pulled from various places.  Is it ok to use without the worry of sql injection?<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB"><br /></span><span style="color: #007700">try&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Connect&nbsp;and&nbsp;create&nbsp;the&nbsp;PDO&nbsp;object<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PDO</span><span style="color: #007700">(</span><span style="color: #DD0000">"mysql:host=</span><span style="color: #0000BB">$hostdb</span><span style="color: #DD0000">;&nbsp;dbname=</span><span style="color: #0000BB">$namedb</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$userdb</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$passdb</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exec</span><span style="color: #007700">(</span><span style="color: #DD0000">"SET&nbsp;CHARACTER&nbsp;SET&nbsp;utf8"</span><span style="color: #007700">);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Sets&nbsp;encoding&nbsp;UTF-8<br /><br />&nbsp;&nbsp;//&nbsp;Define&nbsp;and&nbsp;perform&nbsp;the&nbsp;SQL&nbsp;SELECT&nbsp;query<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$sql&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;`db_linux`"</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #0000BB">$sql</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;If&nbsp;the&nbsp;SQL&nbsp;query&nbsp;is&nbsp;successfully&nbsp;performed&nbsp;($result&nbsp;not&nbsp;false)<br />&nbsp;&nbsp;</span><span style="color: #007700">if(</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$cols&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">columnCount</span><span style="color: #007700">();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Number&nbsp;of&nbsp;returned&nbsp;columns<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Parse&nbsp;the&nbsp;result&nbsp;set<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">$sql</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$sql</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fetch_object</span><span style="color: #007700">())<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$plan&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">plan</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$name&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">name</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">text</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />}&nbsp;else&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$plan&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'no&nbsp;plan'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$name&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'NA'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'NA2'</span><span style="color: #007700">;<br /><br />}&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;}&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?6-Database">Database</category>
			<dc:creator>chrisguk</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389701-Is-my-select-statement-secure-enough</guid>
		</item>
		<item>
			<title>MYSQL Update</title>
			<link>http://board.phpbuilder.com/showthread.php?10389699-MYSQL-Update&amp;goto=newpost</link>
			<pubDate>Mon, 13 May 2013 11:23:59 GMT</pubDate>
			<description><![CDATA[HI

Im using the following to update databases


PHP:
---------
MYSQL_QUERY( "insert into $table1 SELECT * FROM $table2 where 1 ");
---------
  


There are 24 fields in each table, my problem is if a reference number ( ie. R12121 ) exists in table1 i want it to update and not add new record, how can this be done?]]></description>
			<content:encoded><![CDATA[<div>HI<br />
<br />
Im using the following to update databases<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">MYSQL_QUERY</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">"insert&nbsp;into&nbsp;</span><span style="color: #0000BB">$table1</span><span style="color: #DD0000">&nbsp;SELECT&nbsp;*&nbsp;FROM&nbsp;</span><span style="color: #0000BB">$table2</span><span style="color: #DD0000">&nbsp;where&nbsp;1&nbsp;"</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div> <br />
There are 24 fields in each table, my problem is if a reference number ( ie. R12121 ) exists in table1 i want it to update and not add new record, how can this be done?</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?6-Database">Database</category>
			<dc:creator>leewad</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389699-MYSQL-Update</guid>
		</item>
	</channel>
</rss>
