<?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>Wed, 16 May 2012 21:34:05 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://board.phpbuilder.com/board/images/misc/rss.jpg</url>
			<title>PHPBuilder.com</title>
			<link>http://www.phpbuilder.com/board</link>
		</image>
		<item>
			<title>need a second pair of eyes</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384497&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 21:20:23 GMT</pubDate>
			<description><![CDATA[i get the following error:

An error occurred in script '/home/content/84/8829884/html/customer-list/results/customer-look-results.php' on line 181:
Undefined variable: output 

I have defined the variable if it fails and if it passes.....

Here is the code what am i missing?

PHP:
---------
<?php
require_once('../includes/mysql_connect_list.php'); //connection file
include('../includes/config.inc.php');  

	
   if(isset($_POST['customer_lookup']))    {
  		$customer_lookup = $_POST['customer_lookup'];
   }else{
  	  $customer_lookup = 1;  // check whether the variable was set
 	}
			
   $query = "SELECT accouunt_number, route, account_name, address, address_line_2, city, state, zip, area_code, phone, ext, fax, email, online_customer
   FROM customer-lookup
   WHERE account_number = $customer_lookup ";


$result= mysql_query($query);

	if( $result === FALSE ){
     
	}else{


    if( mysql_num_rows( $result ) > 0 ){  // results, do stuff!
        

        $data = mysql_fetch_array( $result );

// what is displayed if everything is good       
        $output = <<< HTML
	<table>
<tr> 
<div align="center">
  <table width="750" border="0">
    <tr>
      <td colspan="6"><div align="center"><img src="../../images/midstate_logo.jpg" width="386" height="75"></div></td>
    </tr>
    <tr>
      <td height="74" colspan="6"><div align="center">
        <h2 class="text">Customer Look Up Results</h2>
      </div></td>
    </tr>
    <tr>
      <td width="163">&nbsp;</td>
      <td width="89">&nbsp;</td>
      <td width="212">&nbsp;</td>
      <td width="80">&nbsp;</td>
      <td width="120">&nbsp;</td>
      <td width="60">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2"><div align="center" class="text">Account Number</div></td>
      <td colspan="2"><div align="center" class="text">Account Name</div></td>
      <td colspan="2"><div align="center" class="text">Route</div></td>
    </tr>
    <tr>
      <td colspan="2"><label for="textfield"></label>
        <div align="center">
          <input name="textfield" type="text" id="textfield" value="{$data['accouunt_number']}" size="45">
      </div></td>
      <td colspan="2"><div align="center">
        <input name="textfield2" type="text" id="textfield2" value="{$data['account_name']}" size="45">
      </div></td>
      <td colspan="2"><div align="center">
        <input name="textfield3" type="text" id="textfield3" value="{$data['route']}" size="45">
      </div></td>
    </tr>
    <tr class="text">
      <td colspan="2"><div align="center">Address</div></td>
      <td colspan="2"><div align="center">Address Line 2</div></td>
      <td colspan="2"><div align="center">City</div></td>
    </tr>
    <tr valign="top">
      <td height="38" colspan="2"><div align="center">
        <textarea name="textfield4" cols="45" rows="5" id="textfield4">{$data['address']}</textarea>
      </div></td>
      <td colspan="2"><div align="center">
        <textarea name="textfield5" cols="45" rows="5" id="textfield5">{$data['address_line_2']}</textarea>
      </div></td>
      <td colspan="2"><div align="center">
        <input name="textfield6" type="text" id="textfield6" value="{$data['city']}" size="45">
      </div></td>
    </tr>
    <tr>
      <td colspan="6"><div align="center"></div>       
    </tr>
    <tr class="text">
      <td colspan="2"><div align="center">State</div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">Zip Code</div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">Email</div>        <div align="center"></div></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
        <input name="textfield7" type="text" id="textfield7" value="{$data['state']}" size="45">
      </div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">
        <input name="textfield8" type="text" id="textfield8" value="{$data['zip']}" size="45">
      </div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">
        <input name="textfield9" type="text" id="textfield9" value="{$data['email']}" size="45">
      </div>        <div align="center"></div></td>
    </tr>
    <tr>
      <td colspan="6"><div align="center"></div>    
    </tr>
    <tr class="text">
      <td colspan="2"><div align="center">Area Code</div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">Phone Number</div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">Ext</div>        <div align="center"></div></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
        <input name="textfield10" type="text" id="textfield10" value="{$data['area_code']}" size="45">
      </div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">
        <input name="textfield11" type="text" id="textfield11" value="{$data['phone']}" size="45">
      </div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">
        <input name="textfield12" type="text" id="textfield12" value="{$data['ext']}" size="45">
      </div>        <div align="center"></div></td>
    </tr>
    <tr>
      <td colspan="6"><div align="center"></div>        <div align="center"></div>        <div align="center"></div>        <div align="center"></div>        <div align="center"></div>        <div align="center"></div></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center" class="text">Fax Number</div>        <div align="center"></div></td>
      <td colspan="2"><div align="center" class="text">Online Ordering Customer</div>        <div align="center"></div></td>
      <td colspan="2"><div align="center"></div>      
</td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
        <input name="textfield13" type="text" id="textfield13" value="{$data['fax']}" size="45">
      </div>        <div align="center"></div></td>
      <td colspan="2"><div align="center">
        <input name="textfield14" type="text" id="textfield14" value="{$data['online_customer']}" size="45">
      </div>        <div align="center"></div></td>
      <td colspan="2"><div align="center"></div>        
</td>
    </tr>
    <tr>
      <td colspan="6">&nbsp;</td>
    </tr>
  </table>
</div>
<tr>
  </div>
  </div>
HTML
;
    }else{
        // no results, do something else
        
        $output = 'I am sorry the requested customer could not be found. Please try your search again.<br />
  <a href="http://mysite/customer-list/customer-lookup.php">Retry Your Search </a></div>'; 
		// there was an error! display error message
    }
}
// when you print your page, just add "$output" at the appropriate spot in your HTML markup.
//    if there are results, you'll see the <table>, if not, you'll see the "sorry" message. 
?>
<!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>Survey Results</title>
<style type="text/css">
body {
	background-color: #00F;
}
.text {
	color: #FFF;
}
</style>

</head>

<body>
<div align="center">
  <?php print $output ?>
    
  
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</div>
</body>
</html>
---------
]]></description>
			<content:encoded><![CDATA[<div>i get the following error:<br />
<br />
An error occurred in script '/home/content/84/8829884/html/customer-list/results/customer-look-results.php' on line 181:<br />
Undefined variable: output <br />
<br />
I have defined the variable if it fails and if it passes.....<br />
<br />
Here is the code what am i missing?<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">&lt;?php<br /></font><font color="#007700">require_once(</font><font color="#DD0000">'../includes/mysql_connect_list.php'</font><font color="#007700">); </font><font color="#FF8000">//connection file<br /></font><font color="#007700">include(</font><font color="#DD0000">'../includes/config.inc.php'</font><font color="#007700">);&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;if(isset(</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'customer_lookup'</font><font color="#007700">&#93;))&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$customer_lookup </font><font color="#007700">= </font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'customer_lookup'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;}else{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$customer_lookup </font><font color="#007700">= </font><font color="#0000BB">1</font><font color="#007700">;&nbsp;&nbsp;</font><font color="#FF8000">// check whether the variable was set<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$query </font><font color="#007700">= </font><font color="#DD0000">"SELECT accouunt_number, route, account_name, address, address_line_2, city, state, zip, area_code, phone, ext, fax, email, online_customer<br />&nbsp;&nbsp;&nbsp;FROM customer-lookup<br />&nbsp;&nbsp;&nbsp;WHERE account_number = $customer_lookup "</font><font color="#007700">;<br /><br /><br /></font><font color="#0000BB">$result</font><font color="#007700">= </font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$query</font><font color="#007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if( </font><font color="#0000BB">$result </font><font color="#007700">=== </font><font color="#0000BB">FALSE </font><font color="#007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;}else{<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if( </font><font color="#0000BB">mysql_num_rows</font><font color="#007700">( </font><font color="#0000BB">$result </font><font color="#007700">) &gt; </font><font color="#0000BB">0 </font><font color="#007700">){&nbsp;&nbsp;</font><font color="#FF8000">// results, do stuff!<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$data </font><font color="#007700">= </font><font color="#0000BB">mysql_fetch_array</font><font color="#007700">( </font><font color="#0000BB">$result </font><font color="#007700">);<br /><br /></font><font color="#FF8000">// what is displayed if everything is good&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$output </font><font color="#007700">= &lt;&lt;&lt; HTML<br /></font><font color="#0000BB">&nbsp;&nbsp;&nbsp;&nbsp;&lt;table&gt;<br />&lt;tr&gt; <br />&lt;div align="center"&gt;<br />&nbsp;&nbsp;&lt;table width="750" border="0"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="6"&gt;&lt;div align="center"&gt;&lt;img src="../../images/midstate_logo.jpg" width="386" height="75"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td height="74" colspan="6"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2 class="text"&gt;Customer Look Up Results&lt;/h2&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td width="163"&gt;&amp;nbsp;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td width="89"&gt;&amp;nbsp;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td width="212"&gt;&amp;nbsp;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td width="80"&gt;&amp;nbsp;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td width="120"&gt;&amp;nbsp;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td width="60"&gt;&amp;nbsp;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center" class="text"&gt;Account Number&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center" class="text"&gt;Account Name&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center" class="text"&gt;Route&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;label for="textfield"&gt;&lt;/label&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield" type="text" id="textfield" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'accouunt_number'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield2" type="text" id="textfield2" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'account_name'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield3" type="text" id="textfield3" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'route'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr class="text"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;Address&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;Address Line 2&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;City&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr valign="top"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td height="38" colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;textarea name="textfield4" cols="45" rows="5" id="textfield4"&gt;</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'address'</font><font color="#007700">&#93;}</font><font color="#0000BB">&lt;/textarea&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;textarea name="textfield5" cols="45" rows="5" id="textfield5"&gt;</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'address_line_2'</font><font color="#007700">&#93;}</font><font color="#0000BB">&lt;/textarea&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield6" type="text" id="textfield6" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'city'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="6"&gt;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr class="text"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;State&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;Zip Code&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;Email&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield7" type="text" id="textfield7" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'state'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield8" type="text" id="textfield8" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'zip'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield9" type="text" id="textfield9" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'email'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="6"&gt;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr class="text"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;Area Code&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;Phone Number&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;Ext&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield10" type="text" id="textfield10" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'area_code'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield11" type="text" id="textfield11" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'phone'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield12" type="text" id="textfield12" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'ext'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="6"&gt;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center" class="text"&gt;Fax Number&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center" class="text"&gt;Online Ordering Customer&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield13" type="text" id="textfield13" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'fax'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name="textfield14" type="text" id="textfield14" value="</font><font color="#007700">{</font><font color="#0000BB">$data</font><font color="#007700">&#91;</font><font color="#DD0000">'online_customer'</font><font color="#007700">&#93;}</font><font color="#0000BB">" size="45"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="center"&gt;&lt;/div&gt;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="2"&gt;&lt;div align="center"&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td colspan="6"&gt;&amp;nbsp;&lt;/td&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;<br />&nbsp;&nbsp;&lt;/table&gt;<br />&lt;/div&gt;<br />&lt;tr&gt;<br />&nbsp;&nbsp;&lt;/div&gt;<br />&nbsp;&nbsp;&lt;/div&gt;<br /></font><font color="#007700">HTML<br />;<br />&nbsp;&nbsp;&nbsp;&nbsp;}else{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// no results, do something else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$output </font><font color="#007700">= </font><font color="#DD0000">'I am sorry the requested customer could not be found. Please try your search again.&lt;br /&gt;<br />&nbsp;&nbsp;&lt;a href="http://mysite/customer-list/customer-lookup.php"&gt;Retry Your Search &lt;/a&gt;&lt;/div&gt;'</font><font color="#007700">; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// there was an error! display error message<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">}<br />}<br /></font><font color="#FF8000">// when you print your page, just add "$output" at the appropriate spot in your HTML markup.<br />//&nbsp;&nbsp;&nbsp;&nbsp;if there are results, you'll see the &lt;table&gt;, if not, you'll see the "sorry" message. <br /></font><font color="#0000BB">?&gt;<br /></font>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;<br />&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br />&lt;head&gt;<br />&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;<br />&lt;title&gt;Survey Results&lt;/title&gt;<br />&lt;style type="text/css"&gt;<br />body {<br />&nbsp;&nbsp;&nbsp;&nbsp;background-color: #00F;<br />}<br />.text {<br />&nbsp;&nbsp;&nbsp;&nbsp;color: #FFF;<br />}<br />&lt;/style&gt;<br /><br />&lt;/head&gt;<br /><br />&lt;body&gt;<br />&lt;div align="center"&gt;<br />&nbsp;&nbsp;<font color="#0000BB">&lt;?php </font><font color="#007700">print </font><font color="#0000BB">$output ?&gt;<br /></font>&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&nbsp;&nbsp;&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br />&lt;/div&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div></div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>darkangel2001lv</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384497</guid>
		</item>
		<item>
			<title>Unable to Populate columns in MSQL database</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384496&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 20:45:57 GMT</pubDate>
			<description><![CDATA[Hey everyone-

I am trying to insert a name, email and comment into a database in MQL.  The tablename is guestbook. 

I have a connection to the database but cannot get the entries to be successfully added.  I think it is a problem with my IF conditional for when the form is submitted.  I have tried both the $_REQUEST and $_POST actions but with no luck.

and ideas?  I am using XAMPP.   

Thanks a lot for taking a quick look.  The names are all correct.


PHP:
---------
<?php
//create variable as a string that we will append entires too
$gb_str = "";
$pgeTitle="View and Sign Guestbook";

//if form is submitted than insert into the database
if (!empty ($_REQUEST["submit"])) {
        $name = $_REQUEST["frmName"];
        $email =$_REQUEST["frmEmail"];
        $comment =$_REQUEST["frmComment"];
        $date = Date ("Y-m-d h:i:s");
        
        
        $gb_query = "INSERT INTO guestbook VALUES (0, '$name', '$email',
        '$comment', '$date')";
        
        mysql_query($gb_query);
        $res = mysql_affected_rows();
        
        //test to see if the insert was successful
        if ($res >0) {
            $ret_str="Your guestbook entry was successfully added.";
        }else {
            $ret_str="Your guestbook entry was NOT successfully added.";
        }
        
        //append succss/failure message 
        $gb_str .= "<span class=\"ret\">$ret_str</span><BR>";
       
        }

?>
<?php
//the querystring
$get_query = "SELECT gbName, gbEmail, gbComment, DATE_FORMAT(gbDateAdded, 
    '%m-%d-%y %H:%i')gbDateAdded FROM guestbook";
$get_rs = mysql_query($get_query);


//While there are still results
while ($get_row = mysql_fetch_array($get_rs)) {
     $name = $get_row["gbName"];
     $email= $get_row["gbEmail"];
     $comment=$get_row["gbComment"];
     $date= $get_row["gbDateAdded"];
     
if (!empty($name)) {
    //if the name exists and email exists, link name to the email
    if (!empty($email)) {
        $name="by to:$email\">$name";
        }
        //if the name does not eist and the email exists than link email to email
        } else if (!empty($email)) {
            $name= "by to:$email\">$email";
            //or else make the name blank
        }else {
         $name ="";
       }
       //append to string and will print later on 
       $gb_str .= "<br>$comment<p class=\"small\"><posted on $date $name>";
       
       }
       //Free the result Memory
       mysql_free_result($get_rs);
       ?>
---------
]]></description>
			<content:encoded><![CDATA[<div>Hey everyone-<br />
<br />
I am trying to insert a name, email and comment into a database in MQL.  The tablename is guestbook. <br />
<br />
I have a connection to the database but cannot get the entries to be successfully added.  I think it is a problem with my IF conditional for when the form is submitted.  I have tried both the $_REQUEST and $_POST actions but with no luck.<br />
<br />
and ideas?  I am using XAMPP.   <br />
<br />
Thanks a lot for taking a quick look.  The names are all correct.<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">&lt;?php<br /></font><font color="#FF8000">//create variable as a string that we will append entires too<br /></font><font color="#0000BB">$gb_str </font><font color="#007700">= </font><font color="#DD0000">""</font><font color="#007700">;<br /></font><font color="#0000BB">$pgeTitle</font><font color="#007700">=</font><font color="#DD0000">"View and Sign Guestbook"</font><font color="#007700">;<br /><br /></font><font color="#FF8000">//if form is submitted than insert into the database<br /></font><font color="#007700">if (!empty (</font><font color="#0000BB">$_REQUEST</font><font color="#007700">&#91;</font><font color="#DD0000">"submit"</font><font color="#007700">&#93;)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$name </font><font color="#007700">= </font><font color="#0000BB">$_REQUEST</font><font color="#007700">&#91;</font><font color="#DD0000">"frmName"</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$email </font><font color="#007700">=</font><font color="#0000BB">$_REQUEST</font><font color="#007700">&#91;</font><font color="#DD0000">"frmEmail"</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$comment </font><font color="#007700">=</font><font color="#0000BB">$_REQUEST</font><font color="#007700">&#91;</font><font color="#DD0000">"frmComment"</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$date </font><font color="#007700">= </font><font color="#0000BB">Date </font><font color="#007700">(</font><font color="#DD0000">"Y-m-d h:i:s"</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$gb_query </font><font color="#007700">= </font><font color="#DD0000">"INSERT INTO guestbook VALUES (0, '$name', '$email',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'$comment', '$date')"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$gb_query</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$res </font><font color="#007700">= </font><font color="#0000BB">mysql_affected_rows</font><font color="#007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//test to see if the insert was successful<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">if (</font><font color="#0000BB">$res </font><font color="#007700">&gt;</font><font color="#0000BB">0</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$ret_str</font><font color="#007700">=</font><font color="#DD0000">"Your guestbook entry was successfully added."</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$ret_str</font><font color="#007700">=</font><font color="#DD0000">"Your guestbook entry was NOT successfully added."</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//append succss/failure message <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$gb_str </font><font color="#007700">.= </font><font color="#DD0000">"&lt;span class=\"ret\"&gt;$ret_str&lt;/span&gt;&lt;BR&gt;"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br /></font><font color="#0000BB">?&gt;<br />&lt;?php<br /></font><font color="#FF8000">//the querystring<br /></font><font color="#0000BB">$get_query </font><font color="#007700">= </font><font color="#DD0000">"SELECT gbName, gbEmail, gbComment, DATE_FORMAT(gbDateAdded, <br />&nbsp;&nbsp;&nbsp;&nbsp;'%m-%d-%y %H:%i')gbDateAdded FROM guestbook"</font><font color="#007700">;<br /></font><font color="#0000BB">$get_rs </font><font color="#007700">= </font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$get_query</font><font color="#007700">);<br /><br /><br /></font><font color="#FF8000">//While there are still results<br /></font><font color="#007700">while (</font><font color="#0000BB">$get_row </font><font color="#007700">= </font><font color="#0000BB">mysql_fetch_array</font><font color="#007700">(</font><font color="#0000BB">$get_rs</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$name </font><font color="#007700">= </font><font color="#0000BB">$get_row</font><font color="#007700">&#91;</font><font color="#DD0000">"gbName"</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$email</font><font color="#007700">= </font><font color="#0000BB">$get_row</font><font color="#007700">&#91;</font><font color="#DD0000">"gbEmail"</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$comment</font><font color="#007700">=</font><font color="#0000BB">$get_row</font><font color="#007700">&#91;</font><font color="#DD0000">"gbComment"</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$date</font><font color="#007700">= </font><font color="#0000BB">$get_row</font><font color="#007700">&#91;</font><font color="#DD0000">"gbDateAdded"</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />if (!empty(</font><font color="#0000BB">$name</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//if the name exists and email exists, link name to the email<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">if (!empty(</font><font color="#0000BB">$email</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$name</font><font color="#007700">=</font><font color="#DD0000">"by to:$email\"&gt;$name"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//if the name does not eist and the email exists than link email to email<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">} else if (!empty(</font><font color="#0000BB">$email</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$name</font><font color="#007700">= </font><font color="#DD0000">"by to:$email\"&gt;$email"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//or else make the name blank<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">}else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$name </font><font color="#007700">=</font><font color="#DD0000">""</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//append to string and will print later on <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$gb_str </font><font color="#007700">.= </font><font color="#DD0000">"&lt;br&gt;$comment&lt;p class=\"small\"&gt;&lt;posted on $date $name&gt;"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//Free the result Memory<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">mysql_free_result</font><font color="#007700">(</font><font color="#0000BB">$get_rs</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">?&gt;</font>
</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div></div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=6">Database</category>
			<dc:creator>mshane8</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384496</guid>
		</item>
		<item>
			<title>Counting Instances and then displaying a result.</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384495&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 20:33:22 GMT</pubDate>
			<description><![CDATA[Hi

I am building a product search engine using MySql and PHP (Jquery / AJAX). 
As i am getting the search results i wondered is it possible to count the instances of a category?
For example:
If i search for "Dell Laptops" i get 400+ results back because it has lots of laptops and accessories.
What i am aiming for it to do is while looping through look at the categories and if its the first instanc eof it i want it to begin a count. until it has finished looping and then i can display it.
Results: 436 [ Laptops(127) - Accesories (244) - Components(65)  ]

Im not even sure where to start here so any advice will be helpful :)

Here is the code im using to generate the search:
	$id = str_replace(" ", "%", "$id");
	$q = "SELECT * FROM products WHERE prod_name LIKE '%$id%' order by fee asc LIMIT 20";]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
<br />
I am building a product search engine using MySql and PHP (Jquery / AJAX). <br />
As i am getting the search results i wondered is it possible to count the instances of a category?<br />
For example:<br />
If i search for &quot;Dell Laptops&quot; i get 400+ results back because it has lots of laptops and accessories.<br />
What i am aiming for it to do is while looping through look at the categories and if its the first instanc eof it i want it to begin a count. until it has finished looping and then i can display it.<br />
Results: 436 [ Laptops(127) - Accesories (244) - Components(65)  ]<br />
<br />
Im not even sure where to start here so any advice will be helpful :)<br />
<br />
Here is the code im using to generate the search:<br />
	$id = str_replace(&quot; &quot;, &quot;%&quot;, &quot;$id&quot;);<br />
	$q = &quot;SELECT * FROM products WHERE prod_name LIKE '%$id%' order by fee asc LIMIT 20&quot;;</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>gotornot</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384495</guid>
		</item>
		<item>
			<title>video time line showing 00:00</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384493&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 13:30:37 GMT</pubDate>
			<description>I am using ffmpeg to convert any video format to flv.  When i upload mp4/

 wmv /other than flv , the corresponding .flv file is created. but playing

 the video not showing time line. Controlbar is there in player , but the

 time is always showing 00:00



 i am using the code like this 

 ffmpeg -i /sourcepath/bhh.mp4 -f flv  destinationpath/assets/videos/new.flv



 It is working in my server. Showing Audio encode failed in my client  server. lame version in client server is 3.98.2.



 Will this issue get fixed when i upgrade lane to 3.99.5 in my client

 server ? or What is the reason why time line is missing for the converted

 files?</description>
			<content:encoded><![CDATA[<div>I am using ffmpeg to convert any video format to flv.  When i upload mp4/<br />
<br />
 wmv /other than flv , the corresponding .flv file is created. but playing<br />
<br />
 the video not showing time line. Controlbar is there in player , but the<br />
<br />
 time is always showing 00:00<br />
<br />
<br />
<br />
 i am using the code like this <br />
<br />
 ffmpeg -i /sourcepath/bhh.mp4 -f flv  destinationpath/assets/videos/new.flv<br />
<br />
<br />
<br />
 It is working in my server. Showing Audio encode failed in my client  server. lame version in client server is 3.98.2.<br />
<br />
<br />
<br />
 Will this issue get fixed when i upgrade lane to 3.99.5 in my client<br />
<br />
 server ? or What is the reason why time line is missing for the converted<br />
<br />
 files?</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=21">Misc Tools</category>
			<dc:creator>chandraprabha.p</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384493</guid>
		</item>
		<item>
			<title>PHP OOP real-world guidance needed</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384492&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 13:06:39 GMT</pubDate>
			<description><![CDATA[Dear programmers of the information super space highway web,

I need your guidance.

I've been trying now for a long time to wrap my head around OOP. I see its advantages. I've read many, many tutorials and watched an equal amount of videos on the subject. I get the animal/cat/dog examples, I get the car/drive examples. What I'm struggling with is how to apply these concepts in a real-world application. So, I've set out to build one using OOP.

I am not asking for help with syntax or writing specific code  I can find that myself in documentation and by searching forums etc.. What I really need is some guidance, and a push in the right direction every now and  then. Are there any seasoned programmers willing to mentor me?

As my learning project I would like to build a simple classifieds "web app". Something similar to Craigslist but way watered down in terms of scope. I would like to use PHP5 and MySQL, because I am familiar with them.

Let's say there are only these 2 use cases:

1. Posting something for sale
2. Browsing/searching for something to buy

What "things" should be objects? I can imagine that each item could be an object, but at what point? And why?

So for example, the user fills out the "post item for sale" form, should that form get turned into an object which gets passed to another object which inserts the values into a database?

What about when another user is browsing and requests to see all items of category C? Does it make sense that whenever the app has to connect to its database it creates a database object and then gets a bunch of item objects and displays them on the page? writing this out certainly makes me realize how clueless I still am about OOP. Please help me fix that.

If in your opinion this is not a good project to start wading into OOP with, please feel free to suggest another idea!

Thank you.]]></description>
			<content:encoded><![CDATA[<div>Dear programmers of the information super space highway web,<br />
<br />
I need your guidance.<br />
<br />
I've been trying now for a long time to wrap my head around OOP. I see its advantages. I've read many, many tutorials and watched an equal amount of videos on the subject. I get the animal/cat/dog examples, I get the car/drive examples. What I'm struggling with is how to apply these concepts in a real-world application. So, I've set out to build one using OOP.<br />
<br />
I am not asking for help with syntax or writing specific code  I can find that myself in documentation and by searching forums etc.. What I really need is some guidance, and a push in the right direction every now and  then. Are there any seasoned programmers willing to mentor me?<br />
<br />
As my learning project I would like to build a simple classifieds &quot;web app&quot;. Something similar to Craigslist but way watered down in terms of scope. I would like to use PHP5 and MySQL, because I am familiar with them.<br />
<br />
Let's say there are only these 2 use cases:<br />
<br />
1. Posting something for sale<br />
2. Browsing/searching for something to buy<br />
<br />
What &quot;things&quot; should be objects? I can imagine that each item could be an object, but at what point? And why?<br />
<br />
So for example, the user fills out the &quot;post item for sale&quot; form, should that form get turned into an object which gets passed to another object which inserts the values into a database?<br />
<br />
What about when another user is browsing and requests to see all items of category C? Does it make sense that whenever the app has to connect to its database it creates a database object and then gets a bunch of item objects and displays them on the page? writing this out certainly makes me realize how clueless I still am about OOP. Please help me fix that.<br />
<br />
If in your opinion this is not a good project to start wading into OOP with, please feel free to suggest another idea!<br />
<br />
Thank you.</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>bernk</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384492</guid>
		</item>
		<item>
			<title>problem with calculator php</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384491&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 12:20:40 GMT</pubDate>
			<description><![CDATA[Hi everybody i am trying to make a calculator using "switch" but the browser always told me that one of my variable did not exist  i realy need some help and thank u 


PHP:
---------
<html>
<head>
<title>
FORMULAIRE CALCULATRICE
</title>
</head>
<body>
<pre>
<form action="calculatrice.php" method=" POST">
ENTRER VOTRE 1<sup>ere</sup>NOMBRE :<input type="text"  name="nbr1"   size="4">
ENTRER VOTRE 2<sup>eme</sup>NOMBRE :<input type="text"  name="nbr2" size="4">

CHOIX D'OPERATION : <select name="operation" >
<option value="+">+</option>
<option VALUE="-"> -</option>
<option value="*">*</option>
<option value="/"> /</option>
<option value="%"> %</option>
</select>


<input type ="submit"  value="calculer"/>
</pre>
</form>
</body>
</html>
<?php
echo"h1";
 if ( isset($_POST['nbr1']) && isset ($_POST['nbr2'])  && isset($_POST['operation'] )){

   if ( !empty ( $_POST['nbr1'] ) && !empty( $_POST['nbr2'] ) && !empty( $_POST['operation'] )){
   
   
   $n1=$_POST['nbr1'];
   $n2=$_POST['nbr2'];
   $opr=$_POST['operation'];
   
   
   switch($opr) {

   case'+': $c=$n1+$n2 ;
                
                break;
   case'-': $c=$n1-$n2 ;
                
                break;
   case'*': $c=$n1*$n2 ;
                
                break;
				
   case'/': if($n2!=0){
                $c=$n1/$n2 ;
                }
                else echo"Erreur, Division impossible!";
				break;
				
	
	case'%':if($n2 != 0){ 
	            $c=$n1%$n2 ;
                }
                else echo"Erreur, Division impossible  !";
				break;
				
				default :ECHO" SVP choisissez un operation a effectuι";
   
 echo "the result is $c "
   }
   }
   else echo" one of ur variabl is  vide"; }
   else echo" one of ur variable did not exist ";
?>
---------
]]></description>
			<content:encoded><![CDATA[<div>Hi everybody i am trying to make a calculator using &quot;switch&quot; but the browser always told me that one of my variable did not exist  i realy need some help and thank u <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">
&lt;html&gt;<br />&lt;head&gt;<br />&lt;title&gt;<br />FORMULAIRE CALCULATRICE<br />&lt;/title&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />&lt;pre&gt;<br />&lt;form action="calculatrice.php" method=" POST"&gt;<br />ENTRER VOTRE 1&lt;sup&gt;ere&lt;/sup&gt;NOMBRE :&lt;input type="text"&nbsp;&nbsp;name="nbr1"&nbsp;&nbsp;&nbsp;size="4"&gt;<br />ENTRER VOTRE 2&lt;sup&gt;eme&lt;/sup&gt;NOMBRE :&lt;input type="text"&nbsp;&nbsp;name="nbr2" size="4"&gt;<br /><br />CHOIX D'OPERATION : &lt;select name="operation" &gt;<br />&lt;option value="+"&gt;+&lt;/option&gt;<br />&lt;option VALUE="-"&gt; -&lt;/option&gt;<br />&lt;option value="*"&gt;*&lt;/option&gt;<br />&lt;option value="/"&gt; /&lt;/option&gt;<br />&lt;option value="%"&gt; %&lt;/option&gt;<br />&lt;/select&gt;<br /><br /><br />&lt;input type ="submit"&nbsp;&nbsp;value="calculer"/&gt;<br />&lt;/pre&gt;<br />&lt;/form&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br /><font color="#0000BB">&lt;?php<br /></font><font color="#007700">echo</font><font color="#DD0000">"h1"</font><font color="#007700">;<br /> if ( isset(</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'nbr1'</font><font color="#007700">&#93;) &amp;&amp; isset (</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'nbr2'</font><font color="#007700">&#93;)&nbsp;&nbsp;&amp;&amp; isset(</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'operation'</font><font color="#007700">&#93; )){<br /><br />&nbsp;&nbsp;&nbsp;if ( !empty ( </font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'nbr1'</font><font color="#007700">&#93; ) &amp;&amp; !empty( </font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'nbr2'</font><font color="#007700">&#93; ) &amp;&amp; !empty( </font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'operation'</font><font color="#007700">&#93; )){<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$n1</font><font color="#007700">=</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'nbr1'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$n2</font><font color="#007700">=</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'nbr2'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$opr</font><font color="#007700">=</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'operation'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;switch(</font><font color="#0000BB">$opr</font><font color="#007700">) {<br /><br />&nbsp;&nbsp;&nbsp;case</font><font color="#DD0000">'+'</font><font color="#007700">: </font><font color="#0000BB">$c</font><font color="#007700">=</font><font color="#0000BB">$n1</font><font color="#007700">+</font><font color="#0000BB">$n2 </font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;case</font><font color="#DD0000">'-'</font><font color="#007700">: </font><font color="#0000BB">$c</font><font color="#007700">=</font><font color="#0000BB">$n1</font><font color="#007700">-</font><font color="#0000BB">$n2 </font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;case</font><font color="#DD0000">'*'</font><font color="#007700">: </font><font color="#0000BB">$c</font><font color="#007700">=</font><font color="#0000BB">$n1</font><font color="#007700">*</font><font color="#0000BB">$n2 </font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;case</font><font color="#DD0000">'/'</font><font color="#007700">: if(</font><font color="#0000BB">$n2</font><font color="#007700">!=</font><font color="#0000BB">0</font><font color="#007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$c</font><font color="#007700">=</font><font color="#0000BB">$n1</font><font color="#007700">/</font><font color="#0000BB">$n2 </font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else echo</font><font color="#DD0000">"Erreur, Division impossible!"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;case</font><font color="#DD0000">'%'</font><font color="#007700">:if(</font><font color="#0000BB">$n2 </font><font color="#007700">!= </font><font color="#0000BB">0</font><font color="#007700">){ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$c</font><font color="#007700">=</font><font color="#0000BB">$n1</font><font color="#007700">%</font><font color="#0000BB">$n2 </font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else echo</font><font color="#DD0000">"Erreur, Division impossible&nbsp;&nbsp;!"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default :ECHO</font><font color="#DD0000">" SVP choisissez un operation a effectuι"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;<br /> echo </font><font color="#DD0000">"the result is $c "<br />&nbsp;&nbsp;&nbsp;</font><font color="#007700">}<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;else echo</font><font color="#DD0000">" one of ur variabl is&nbsp;&nbsp;vide"</font><font color="#007700">; }<br />&nbsp;&nbsp;&nbsp;else echo</font><font color="#DD0000">" one of ur variable did not exist "</font><font color="#007700">;<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div></div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=2">General Help</category>
			<dc:creator>girard</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384491</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] PHP Search Query]]></title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384490&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 11:36:06 GMT</pubDate>
			<description><![CDATA[Hi All.
I am looking to search a database of products based upon someone typing the name of the product they are looking for.
I am using the below SQL request:

Unfortunately this only shows what ever your typing and anything before or after (%) is there any way that it could also search unplaced string instances?
For example
$q = "SELECT * FROM products WHERE prod_name LIKE '%$id%' order by fee asc LIMIT 20";

If i type black ops ps3 it brings back search result until i get to the PS3 part. because entries in the db are "black ops for the PS3" because i havent conformed it says no results.
I need it to show all results.
is there another way? or can someone point me in the right direction?]]></description>
			<content:encoded><![CDATA[<div>Hi All.<br />
I am looking to search a database of products based upon someone typing the name of the product they are looking for.<br />
I am using the below SQL request:<br />
<br />
Unfortunately this only shows what ever your typing and anything before or after (%) is there any way that it could also search unplaced string instances?<br />
For example<br />
$q = &quot;SELECT * FROM products WHERE prod_name LIKE '%$id%' order by fee asc LIMIT 20&quot;;<br />
<br />
If i type black ops ps3 it brings back search result until i get to the PS3 part. because entries in the db are &quot;black ops for the PS3&quot; because i havent conformed it says no results.<br />
I need it to show all results.<br />
is there another way? or can someone point me in the right direction?</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>gotornot</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384490</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] how to executing two queries in same script]]></title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384489&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 05:59:40 GMT</pubDate>
			<description><![CDATA[I have come with my own way to build up a system log feature for admins. It is storing some information to a separate. But i have some problems to how to execute those two queries @ the same time.
this is my add_user_save.php page


PHP:
---------

<!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>
<title></title>
</head>
<body>

                    
               <div align="right"> you are logged as <?php echo $_SESSION['SESS_LOGIN'];?> |<a href="adduser.php"> Add another user</a> | <a href="member-index.php"> Home </a> | <a href="logout.php">Logout </a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
      
<?php

if(!isset($_SESSION['SESS_LOGIN']) || $_SESSION['SESS_TYPE'] !='admin')  
 {                                                                                
  echo '<script language="javascript">';
  echo  'alert("Please login as ADMINISTRATOR to add a user");'; 
  echo	' window.location.replace("index.html");';
  echo  '</script>';                

}
else
{
      include("config.php");

$login    = mysql_real_escape_string($_POST['login']);
$password = mysql_real_escape_string($_POST['password']);
$type     = mysql_real_escape_string($_POST['type']);
$email    = mysql_real_escape_string($_POST['email']);
$password = md5($password);


$qry_add = " INSERT INTO members
             (login, password, type, email )
             VALUES ('$login', '$password', '$type', '$email') ";

$sql_log = " INSERT INTO system_log (Entry_Date, login, Activity, Description ) 
             VALUES (NOW(), '".$_SESSION["SESS_LOGIN"]."', 'ADD USER', '$login')";


		$checkformembers = mysql_query("SELECT * FROM members WHERE login='$login'");
if(mysql_num_rows($checkformembers) != 0)
			{
		    echo "<font color=red> Duplicate Entry. Please Verify User name !</font>";
			}
		else
			{
				
			   $result=mysql_query($qry_add);
			   $result1=mysql_query($qry_log);
			   if (($result !=0) && ($result1!=0))
			   //if ($result) 
				 {
			       echo "<br><font color=green size=+1 >you have successfully added new user !  </font> " ;
			     }			
			   else
			     {
			       echo "<br><font color=red size=+1 >Problem in Adding !</font><br>" ;
			       echo "ERROR - unable to save new username and password!<br>";
                   $SQLError =  "SQL ERROR: ".mysql_errno().".  ".mysql_error()."<BR><BR>";
                   echo "$SQLError";
                   mysql_close();
			     }
			}
			  
}
?>
</body>
</html>
---------
this is the error i got >> SQL ERROR: 1065. Query was empty]]></description>
			<content:encoded><![CDATA[<div>I have come with my own way to build up a system log feature for admins. It is storing some information to a separate. But i have some problems to how to execute those two queries @ the same time.<br />
this is my add_user_save.php page<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">
<br />&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;<br />&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br />&lt;head&gt;<br />&lt;title&gt;&lt;/title&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div align="right"&gt; you are logged as <font color="#0000BB">&lt;?php </font><font color="#007700">echo </font><font color="#0000BB">$_SESSION</font><font color="#007700">&#91;</font><font color="#DD0000">'SESS_LOGIN'</font><font color="#007700">&#93;;</font><font color="#0000BB">?&gt;</font> |&lt;a href="adduser.php"&gt; Add another user&lt;/a&gt; | &lt;a href="member-index.php"&gt; Home &lt;/a&gt; | &lt;a href="logout.php"&gt;Logout &lt;/a&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><font color="#0000BB">&lt;?php<br /><br /></font><font color="#007700">if(!isset(</font><font color="#0000BB">$_SESSION</font><font color="#007700">&#91;</font><font color="#DD0000">'SESS_LOGIN'</font><font color="#007700">&#93;) || </font><font color="#0000BB">$_SESSION</font><font color="#007700">&#91;</font><font color="#DD0000">'SESS_TYPE'</font><font color="#007700">&#93; !=</font><font color="#DD0000">'admin'</font><font color="#007700">)&nbsp;&nbsp;<br /> {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;echo </font><font color="#DD0000">'&lt;script language="javascript"&gt;'</font><font color="#007700">;<br />&nbsp;&nbsp;echo&nbsp;&nbsp;</font><font color="#DD0000">'alert("Please login as ADMINISTRATOR to add a user");'</font><font color="#007700">; <br />&nbsp;&nbsp;echo&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#DD0000">' window.location.replace("index.html");'</font><font color="#007700">;<br />&nbsp;&nbsp;echo&nbsp;&nbsp;</font><font color="#DD0000">'&lt;/script&gt;'</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />}<br />else<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;include(</font><font color="#DD0000">"config.php"</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$login&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">= </font><font color="#0000BB">mysql_real_escape_string</font><font color="#007700">(</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'login'</font><font color="#007700">&#93;);<br /></font><font color="#0000BB">$password </font><font color="#007700">= </font><font color="#0000BB">mysql_real_escape_string</font><font color="#007700">(</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'password'</font><font color="#007700">&#93;);<br /></font><font color="#0000BB">$type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">= </font><font color="#0000BB">mysql_real_escape_string</font><font color="#007700">(</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'type'</font><font color="#007700">&#93;);<br /></font><font color="#0000BB">$email&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">= </font><font color="#0000BB">mysql_real_escape_string</font><font color="#007700">(</font><font color="#0000BB">$_POST</font><font color="#007700">&#91;</font><font color="#DD0000">'email'</font><font color="#007700">&#93;);<br /></font><font color="#0000BB">$password </font><font color="#007700">= </font><font color="#0000BB">md5</font><font color="#007700">(</font><font color="#0000BB">$password</font><font color="#007700">);<br /><br /><br /></font><font color="#0000BB">$qry_add </font><font color="#007700">= </font><font color="#DD0000">" INSERT INTO members<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(login, password, type, email )<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUES ('$login', '$password', '$type', '$email') "</font><font color="#007700">;<br /><br /></font><font color="#0000BB">$sql_log </font><font color="#007700">= </font><font color="#DD0000">" INSERT INTO system_log (Entry_Date, login, Activity, Description ) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUES (NOW(), '"</font><font color="#007700">.</font><font color="#0000BB">$_SESSION</font><font color="#007700">&#91;</font><font color="#DD0000">"SESS_LOGIN"</font><font color="#007700">&#93;.</font><font color="#DD0000">"', 'ADD USER', '$login')"</font><font color="#007700">;<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$checkformembers </font><font color="#007700">= </font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#DD0000">"SELECT * FROM members WHERE login='$login'"</font><font color="#007700">);<br />if(</font><font color="#0000BB">mysql_num_rows</font><font color="#007700">(</font><font color="#0000BB">$checkformembers</font><font color="#007700">) != </font><font color="#0000BB">0</font><font color="#007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"&lt;font color=red&gt; Duplicate Entry. Please Verify User name !&lt;/font&gt;"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result</font><font color="#007700">=</font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$qry_add</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result1</font><font color="#007700">=</font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$qry_log</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ((</font><font color="#0000BB">$result </font><font color="#007700">!=</font><font color="#0000BB">0</font><font color="#007700">) &amp;&amp; (</font><font color="#0000BB">$result1</font><font color="#007700">!=</font><font color="#0000BB">0</font><font color="#007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//if ($result) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"&lt;br&gt;&lt;font color=green size=+1 &gt;you have successfully added new user !&nbsp;&nbsp;&lt;/font&gt; " </font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"&lt;br&gt;&lt;font color=red size=+1 &gt;Problem in Adding !&lt;/font&gt;&lt;br&gt;" </font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"ERROR - unable to save new username and password!&lt;br&gt;"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$SQLError </font><font color="#007700">=&nbsp;&nbsp;</font><font color="#DD0000">"SQL ERROR: "</font><font color="#007700">.</font><font color="#0000BB">mysql_errno</font><font color="#007700">().</font><font color="#DD0000">".&nbsp;&nbsp;"</font><font color="#007700">.</font><font color="#0000BB">mysql_error</font><font color="#007700">().</font><font color="#DD0000">"&lt;BR&gt;&lt;BR&gt;"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"$SQLError"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">mysql_close</font><font color="#007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />}<br /></font><font color="#0000BB">?&gt;<br /></font>&lt;/body&gt;<br />&lt;/html&gt;</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div>this is the error i got &gt;&gt; SQL ERROR: 1065. Query was empty</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>vidz</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384489</guid>
		</item>
		<item>
			<title>return list of distinct items from multiple columns</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384488&amp;goto=newpost</link>
			<pubDate>Wed, 16 May 2012 04:20:17 GMT</pubDate>
			<description>Thanks to all who have offered me help and advice....I am learning a lot but still need your help as i cant figure out the best way to do this not sure if the problem is my database and i should redesign




PHP:
---------

example table and fields

fruit_1            fruit_2           fruit_3         fruit_4

apples            oranges            pears

oranges                                               melon


                                                      apples
---------
Is this database design suitable?

How do I go from this to a string of distinct fruit? using SQL and/or PHP

apples, oranges, pears, melon



thanks for all your help</description>
			<content:encoded><![CDATA[<div>Thanks to all who have offered me help and advice....I am learning a lot but still need your help as i cant figure out the best way to do this not sure if the problem is my database and i should redesign<br />
<br />
<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"><br />example table </font><font color="#007700">and </font><font color="#0000BB">fields<br /><br />fruit_1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fruit_2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fruit_3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fruit_4<br /><br />apples&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oranges&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pears<br /><br />oranges&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;melon<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apples <br /></font>
</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div>Is this database design suitable?<br />
<br />
How do I go from this to a string of distinct fruit? using SQL and/or PHP<br />
<br />
apples, oranges, pears, melon<br />
<br />
<br />
<br />
thanks for all your help</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>Dereksdontrun</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384488</guid>
		</item>
		<item>
			<title>Parse error: syntax error, i have no clue why?</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384487&amp;goto=newpost</link>
			<pubDate>Tue, 15 May 2012 23:33:36 GMT</pubDate>
			<description><![CDATA[i am taking a class in PHP and get emailed assignments, this one was to provide the output to the following code, but the code the teacher sent doesnt seem to work.  

im getting : 
*Parse error: syntax error, unexpected '*' in C:\xampp\htdocs\assignment5.php on line 15*

heres code:

PHP:
---------
for ($n = 0; $n < 8; $n++)
         {
           print $n;
           switch ($n % 3)
             {
               case 0 : print (H);
               case 1 : print (E);
                        break;
               case 2 : print(\n);
             }
         }
       print (\n);
       print (***);
       print (\n);
       $n = 10;
       while (++$n <= 13)
        {
         print $n;
        }
       do
        {
         print $n;
        }
       while(++$n <= 12);
       print (\n);
       print (***);
       print (\n);
       for ($n = 1; $n * $n < 60; $n += 3)
        { 
         print $n;
         print (\n);
        }
       for ($n = 4; $n > 0; $n--)
         {
           for ($m = 0; $m <= $n; $m++)
            {
             print (+);
            }
           print (\n);
         }
---------
anyone able to help?]]></description>
			<content:encoded><![CDATA[<div>i am taking a class in PHP and get emailed assignments, this one was to provide the output to the following code, but the code the teacher sent doesnt seem to work.  <br />
<br />
im getting : <br />
<b>Parse error: syntax error, unexpected '*' in C:\xampp\htdocs\assignment5.php on line 15</b><br />
<br />
heres code:<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"></font><font color="#007700">for (</font><font color="#0000BB">$n </font><font color="#007700">= </font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$n </font><font color="#007700">&lt; </font><font color="#0000BB">8</font><font color="#007700">; </font><font color="#0000BB">$n</font><font color="#007700">++)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print </font><font color="#0000BB">$n</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch (</font><font color="#0000BB">$n </font><font color="#007700">% </font><font color="#0000BB">3</font><font color="#007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case </font><font color="#0000BB">0 </font><font color="#007700">: print (</font><font color="#0000BB">H</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case </font><font color="#0000BB">1 </font><font color="#007700">: print (</font><font color="#0000BB">E</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case </font><font color="#0000BB">2 </font><font color="#007700">: print(</font><font color="#0000BB">n</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB">n</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB"></font><font color="#007700">***</font><font color="#0000BB"></font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB">n</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$n </font><font color="#007700">= </font><font color="#0000BB">10</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while (++</font><font color="#0000BB">$n </font><font color="#007700">&lt;= </font><font color="#0000BB">13</font><font color="#007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print </font><font color="#0000BB">$n</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print </font><font color="#0000BB">$n</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while(++</font><font color="#0000BB">$n </font><font color="#007700">&lt;= </font><font color="#0000BB">12</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB">n</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB"></font><font color="#007700">***</font><font color="#0000BB"></font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB">n</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (</font><font color="#0000BB">$n </font><font color="#007700">= </font><font color="#0000BB">1</font><font color="#007700">; </font><font color="#0000BB">$n </font><font color="#007700">* </font><font color="#0000BB">$n </font><font color="#007700">&lt; </font><font color="#0000BB">60</font><font color="#007700">; </font><font color="#0000BB">$n </font><font color="#007700">+= </font><font color="#0000BB">3</font><font color="#007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print </font><font color="#0000BB">$n</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB">n</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (</font><font color="#0000BB">$n </font><font color="#007700">= </font><font color="#0000BB">4</font><font color="#007700">; </font><font color="#0000BB">$n </font><font color="#007700">&gt; </font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$n</font><font color="#007700">--)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (</font><font color="#0000BB">$m </font><font color="#007700">= </font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$m </font><font color="#007700">&lt;= </font><font color="#0000BB">$n</font><font color="#007700">; </font><font color="#0000BB">$m</font><font color="#007700">++)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB"></font><font color="#007700">+</font><font color="#0000BB"></font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (</font><font color="#0000BB">n</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br /></font><font color="#0000BB"></font>
</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div>anyone able to help?</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>gocitygo123</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384487</guid>
		</item>
		<item>
			<title>need help comparing data between sources</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384486&amp;goto=newpost</link>
			<pubDate>Tue, 15 May 2012 22:14:23 GMT</pubDate>
			<description><![CDATA[Hi there everyone,

I'm using some classes to contact a remote server and get some information on guild members(php battlenet wow armory api (https://sourceforge.net/p/wowarmoryapi/home/Home/)).  I've figured out how to grab the data from the remote server and for each remote member record, check the local db and insert new or update existing.  What I'm unable to figure out is how to do the following:

If there's a local record of a member that isn't in the remote data, I need to change the local record to reflect active=0 for that row.  I think I need to compare two arrays, but I don't know how to implement this.

Here's my current code:


PHP:
---------
			$members = $guild->getMembers('rank', 'asc');
			$update_count = 0;
			$insert_count = 0;
			foreach($members as $member) {
				
				//Get character information
				$mname = $member['character']['name'];
				$mgender = $member['character']['gender'];
				$mlevel = $member['character']['level'];
				$mrace = $member['character']['race'];
				$mclass = $member['character']['class'];
				$mrank = $member['rank'];

				$query = "SELECT name FROM addon_guild_members WHERE name='$mname'";
				$result = mysql_query ($query) or die('MySQL error: ' . mysql_error() . '<hr/>' . $query);
				$result_rows = mysql_num_rows($result);
				if($result_rows==1){
					//Match found in the local db.  Update row.
					mysql_query("UPDATE addon_guild_members SET gender = '$mgender', level = '$mlevel', race = '$race', class = '$mclass', rank = '$mrank', active = '1'  WHERE name = '$mname'") or die("Failed to update member in the database.<br><br>" . mysql_error());	
					$update_count = $update_count + 1;
				}elseif($result_rows==0){
					//No local record found.  Insert new row.
					$query2="INSERT INTO addon_guild_members (name,gender,level,race,class,rank,active) VALUES ('$mname','$mgender','$mlevel','$mrace','$mclass','$mrank','1')";
					$result2=mysql_query($query2) or die("Failed to insert new member into database.<br><br>" . mysql_error());
					$insert_count = $insert_count + 1;
				}

				// $results .= "<span style='color: " . $classColor . "'>Name: ".$mname." -> G Rank: ".$mrank." -> Gender: ".$mgender." -> Level: ".$mlevel." -> Race: ".$mrace."</span><br />";

			}
			
			echo("<b>The roster has been updated. ".$insert_count." new members have been added and ".$update_count." current members have been updated.</b>");
---------
I would very much appreciate it if someone could help me figure out how to set active = 0 on the local member row if it no longer exists in the data returned from the remote data.

If you need some data from the classes I use, I'll be happy to post it, I just don't know what would be useful.

Thanks a bunch for your time!]]></description>
			<content:encoded><![CDATA[<div>Hi there everyone,<br />
<br />
I'm using some classes to contact a remote server and get some information on guild members(<a rel="nofollow" href="https://sourceforge.net/p/wowarmoryapi/home/Home/" target="_blank">php battlenet wow armory api</a>).  I've figured out how to grab the data from the remote server and for each remote member record, check the local db and insert new or update existing.  What I'm unable to figure out is how to do the following:<br />
<br />
If there's a local record of a member that isn't in the remote data, I need to change the local record to reflect active=0 for that row.  I think I need to compare two arrays, but I don't know how to implement this.<br />
<br />
Here's my current code:<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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$members </font><font color="#007700">= </font><font color="#0000BB">$guild</font><font color="#007700">-&gt;</font><font color="#0000BB">getMembers</font><font color="#007700">(</font><font color="#DD0000">'rank'</font><font color="#007700">, </font><font color="#DD0000">'asc'</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$update_count </font><font color="#007700">= </font><font color="#0000BB">0</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$insert_count </font><font color="#007700">= </font><font color="#0000BB">0</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach(</font><font color="#0000BB">$members </font><font color="#007700">as </font><font color="#0000BB">$member</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//Get character information<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$mname </font><font color="#007700">= </font><font color="#0000BB">$member</font><font color="#007700">&#91;</font><font color="#DD0000">'character'</font><font color="#007700">&#93;&#91;</font><font color="#DD0000">'name'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$mgender </font><font color="#007700">= </font><font color="#0000BB">$member</font><font color="#007700">&#91;</font><font color="#DD0000">'character'</font><font color="#007700">&#93;&#91;</font><font color="#DD0000">'gender'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$mlevel </font><font color="#007700">= </font><font color="#0000BB">$member</font><font color="#007700">&#91;</font><font color="#DD0000">'character'</font><font color="#007700">&#93;&#91;</font><font color="#DD0000">'level'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$mrace </font><font color="#007700">= </font><font color="#0000BB">$member</font><font color="#007700">&#91;</font><font color="#DD0000">'character'</font><font color="#007700">&#93;&#91;</font><font color="#DD0000">'race'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$mclass </font><font color="#007700">= </font><font color="#0000BB">$member</font><font color="#007700">&#91;</font><font color="#DD0000">'character'</font><font color="#007700">&#93;&#91;</font><font color="#DD0000">'class'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$mrank </font><font color="#007700">= </font><font color="#0000BB">$member</font><font color="#007700">&#91;</font><font color="#DD0000">'rank'</font><font color="#007700">&#93;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$query </font><font color="#007700">= </font><font color="#DD0000">"SELECT name FROM addon_guild_members WHERE name='$mname'"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result </font><font color="#007700">= </font><font color="#0000BB">mysql_query </font><font color="#007700">(</font><font color="#0000BB">$query</font><font color="#007700">) or die(</font><font color="#DD0000">'MySQL error: ' </font><font color="#007700">. </font><font color="#0000BB">mysql_error</font><font color="#007700">() . </font><font color="#DD0000">'&lt;hr/&gt;' </font><font color="#007700">. </font><font color="#0000BB">$query</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result_rows </font><font color="#007700">= </font><font color="#0000BB">mysql_num_rows</font><font color="#007700">(</font><font color="#0000BB">$result</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</font><font color="#0000BB">$result_rows</font><font color="#007700">==</font><font color="#0000BB">1</font><font color="#007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//Match found in the local db.&nbsp;&nbsp;Update row.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#DD0000">"UPDATE addon_guild_members SET gender = '$mgender', level = '$mlevel', race = '$race', class = '$mclass', rank = '$mrank', active = '1'&nbsp;&nbsp;WHERE name = '$mname'"</font><font color="#007700">) or die(</font><font color="#DD0000">"Failed to update member in the database.&lt;br&gt;&lt;br&gt;" </font><font color="#007700">. </font><font color="#0000BB">mysql_error</font><font color="#007700">());&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$update_count </font><font color="#007700">= </font><font color="#0000BB">$update_count </font><font color="#007700">+ </font><font color="#0000BB">1</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}elseif(</font><font color="#0000BB">$result_rows</font><font color="#007700">==</font><font color="#0000BB">0</font><font color="#007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">//No local record found.&nbsp;&nbsp;Insert new row.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$query2</font><font color="#007700">=</font><font color="#DD0000">"INSERT INTO addon_guild_members (name,gender,level,race,class,rank,active) VALUES ('$mname','$mgender','$mlevel','$mrace','$mclass','$mrank','1')"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result2</font><font color="#007700">=</font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$query2</font><font color="#007700">) or die(</font><font color="#DD0000">"Failed to insert new member into database.&lt;br&gt;&lt;br&gt;" </font><font color="#007700">. </font><font color="#0000BB">mysql_error</font><font color="#007700">());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$insert_count </font><font color="#007700">= </font><font color="#0000BB">$insert_count </font><font color="#007700">+ </font><font color="#0000BB">1</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// $results .= "&lt;span style='color: " . $classColor . "'&gt;Name: ".$mname." -&gt; G Rank: ".$mrank." -&gt; Gender: ".$mgender." -&gt; Level: ".$mlevel." -&gt; Race: ".$mrace."&lt;/span&gt;&lt;br /&gt;";<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo(</font><font color="#DD0000">"&lt;b&gt;The roster has been updated. "</font><font color="#007700">.</font><font color="#0000BB">$insert_count</font><font color="#007700">.</font><font color="#DD0000">" new members have been added and "</font><font color="#007700">.</font><font color="#0000BB">$update_count</font><font color="#007700">.</font><font color="#DD0000">" current members have been updated.&lt;/b&gt;"</font><font color="#007700">); <br /></font><font color="#0000BB"></font>
</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div>I would very much appreciate it if someone could help me figure out how to set active = 0 on the local member row if it no longer exists in the data returned from the remote data.<br />
<br />
If you need some data from the classes I use, I'll be happy to post it, I just don't know what would be useful.<br />
<br />
Thanks a bunch for your time!</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>schwim</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384486</guid>
		</item>
		<item>
			<title>Random Numbers - 2 to 9 digits.</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384485&amp;goto=newpost</link>
			<pubDate>Tue, 15 May 2012 19:13:07 GMT</pubDate>
			<description>If my user request a 2 digit random number I can do that with rand(10,99)

if the want 5 digits then rand(11111,99999)

Instead of writing 8 if statements, one of each option..
if there anyway to take the digit they enter ($rand) and generate the random number ?
Thanks</description>
			<content:encoded><![CDATA[<div>If my user request a 2 digit random number I can do that with rand(10,99)<br />
<br />
if the want 5 digits then rand(11111,99999)<br />
<br />
Instead of writing 8 if statements, one of each option..<br />
if there anyway to take the digit they enter ($rand) and generate the random number ?<br />
Thanks</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>Mad_T</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384485</guid>
		</item>
		<item>
			<title>RegEx Match</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384484&amp;goto=newpost</link>
			<pubDate>Tue, 15 May 2012 19:09:50 GMT</pubDate>
			<description><![CDATA[I need to match using regex like this :

user or user2 or user3 upto user9

user[2-9] how do I do this is PHP.

if $user = preg_match ??

Thanks]]></description>
			<content:encoded><![CDATA[<div>I need to match using regex like this :<br />
<br />
user or user2 or user3 upto user9<br />
<br />
user[2-9] how do I do this is PHP.<br />
<br />
if $user = preg_match ??<br />
<br />
Thanks</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>Mad_T</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384484</guid>
		</item>
		<item>
			<title>mysql_num_rows(): supplied argument is not a valid MySQL</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384483&amp;goto=newpost</link>
			<pubDate>Tue, 15 May 2012 16:56:56 GMT</pubDate>
			<description><![CDATA[I am getting these 3 errors. Please help.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/vrnesor1/public_html/openschool/includes/modules.php on line 35

Warning: include_once(ERROR_PAGE) [function.include-once]: failed to open stream: No such file or directory in /home/vrnesor1/public_html/openschool/includes/modules.php on line 87

Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/vrnesor1/public_html/openschool/includes/modules.php on line 87


PHP:
---------
<?php
/**
* @file		    includes/modules.php
* @description	Module model for checking, deleting, installing modules.
* @package		Open-School v1.0
* @copyright	Copyright (C) 2005 - 2008 Open-School. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Open-School is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
//Shows a Module
function show_module($params)
 {
  if(is_module($params['module']))
  {
   $view = $params['view'];
   $action = $params['action'];
   $id = $params['id'];
   include(MODULES_PATH.$params['module'].'/controller.php');
   }else{
   return false;
   }  
 }
//Check Module.
function is_module($module_name)
 {
  $connection = db_connect();			
  $query = sprintf("SELECT * FROM modules WHERE name = '%s'",
                    mysql_real_escape_string($module_name));			
			$result = mysql_query($query);			
  //Checking Whether the Result is Empty.
			$number_of_news = mysql_num_rows($result);
			if ($number_of_news == 0) 
			{
			  return false;	
			}			
			return true;			
 }
//Returns the array of modules.
function list_modules()
 {
  $connection = db_connect();			
  $query = 'SELECT * FROM modules WHERE system = 0';
			$result = mysql_query($query);
  //Checking Whether the Result is Empty.
			$number_of_news = mysql_num_rows($result);
			if ($number_of_news == 0) 
			{
			  return false;	
			}
			$result = result_to_array($result);
			return $result;			
 }
function list_modules_menu()
 {
  $connection = db_connect();			
  $query = 'SELECT * FROM modules WHERE show_menu = 1';
			$result = mysql_query($query);
  //Checking Whether the Result is Empty.
			$number_of_news = mysql_num_rows($result);
			if ($number_of_news == 0) 
			{
			  return false;	
			}
			$result = result_to_array($result);
			return $result;			
 }
 //Load template.
function load_template($module,$view)
{
 if (file_exists(TEMPLATE_PATH.'modules/'.$module.'/'.$view.'.php'))
 { include_once(TEMPLATE_PATH.'modules/'.$module.'/'.$view.'.php');}
elseif (file_exists(TEMPLATE_PATH.'modules/'.$module.'/index.php'))
 { include_once(TEMPLATE_PATH.'modules/'.$module.'/index.php');}
elseif (file_exists(TEMPLATE_PATH.'index.php'))
 { include_once(TEMPLATE_PATH.'index.php');}
elseif (file_exists(SERVER_ROOT.APP_ROOT.'/templates/oslite/modules/'.$module.'/'.$view.'.php'))
 { include_once(SERVER_ROOT.APP_ROOT.'/templates/oslite/modules/'.$module.'/'.$view.'.php');}
elseif (file_exists(SERVER_ROOT.APP_ROOT.'/templates/oslite/modules/'.$module.'/'.'index.php'))
 { include_once(SERVER_ROOT.APP_ROOT.'/templates/oslite/modules/'.$module.'/'.'index.php');}
elseif (file_exists(SERVER_ROOT.APP_ROOT.'/templates/oslite/index.php'))
 { include_once(SERVER_ROOT.APP_ROOT.'/templates/oslite/index.php');}
else
 { include_once(ERROR_PAGE);}
}
?>
---------
]]></description>
			<content:encoded><![CDATA[<div>I am getting these 3 errors. Please help.<br />
<br />
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/vrnesor1/public_html/openschool/includes/modules.php on line 35<br />
<br />
Warning: include_once(ERROR_PAGE) [function.include-once]: failed to open stream: No such file or directory in /home/vrnesor1/public_html/openschool/includes/modules.php on line 87<br />
<br />
Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/vrnesor1/public_html/openschool/includes/modules.php on line 87<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">&lt;?php<br /></font><font color="#FF8000">/**<br />* @file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;includes/modules.php<br />* @description&nbsp;&nbsp;&nbsp;&nbsp;Module model for checking, deleting, installing modules.<br />* @package&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Open-School v1.0<br />* @copyright&nbsp;&nbsp;&nbsp;&nbsp;Copyright (C) 2005 - 2008 Open-School. All rights reserved.<br />* @license&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GNU/GPL, see LICENSE.php<br />* Open-School is free software. This version may have been modified pursuant<br />* to the GNU General Public License, and as distributed it includes or<br />* is derivative of works licensed under the GNU General Public License or<br />* other free or open source software licenses.<br />* See COPYRIGHT.php for copyright notices and details.<br />*/<br />//Shows a Module<br /></font><font color="#007700">function </font><font color="#0000BB">show_module</font><font color="#007700">(</font><font color="#0000BB">$params</font><font color="#007700">)<br /> {<br />&nbsp;&nbsp;if(</font><font color="#0000BB">is_module</font><font color="#007700">(</font><font color="#0000BB">$params</font><font color="#007700">&#91;</font><font color="#DD0000">'module'</font><font color="#007700">&#93;))<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$view </font><font color="#007700">= </font><font color="#0000BB">$params</font><font color="#007700">&#91;</font><font color="#DD0000">'view'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$action </font><font color="#007700">= </font><font color="#0000BB">$params</font><font color="#007700">&#91;</font><font color="#DD0000">'action'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$id </font><font color="#007700">= </font><font color="#0000BB">$params</font><font color="#007700">&#91;</font><font color="#DD0000">'id'</font><font color="#007700">&#93;;<br />&nbsp;&nbsp;&nbsp;include(</font><font color="#0000BB">MODULES_PATH</font><font color="#007700">.</font><font color="#0000BB">$params</font><font color="#007700">&#91;</font><font color="#DD0000">'module'</font><font color="#007700">&#93;.</font><font color="#DD0000">'/controller.php'</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;}else{<br />&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">false</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br /> }<br /></font><font color="#FF8000">//Check Module.<br /></font><font color="#007700">function </font><font color="#0000BB">is_module</font><font color="#007700">(</font><font color="#0000BB">$module_name</font><font color="#007700">)<br /> {<br />&nbsp;&nbsp;</font><font color="#0000BB">$connection </font><font color="#007700">= </font><font color="#0000BB">db_connect</font><font color="#007700">();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;</font><font color="#0000BB">$query </font><font color="#007700">= </font><font color="#0000BB">sprintf</font><font color="#007700">(</font><font color="#DD0000">"SELECT * FROM modules WHERE name = '%s'"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">mysql_real_escape_string</font><font color="#007700">(</font><font color="#0000BB">$module_name</font><font color="#007700">));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result </font><font color="#007700">= </font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$query</font><font color="#007700">);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;</font><font color="#FF8000">//Checking Whether the Result is Empty.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$number_of_news </font><font color="#007700">= </font><font color="#0000BB">mysql_num_rows</font><font color="#007700">(</font><font color="#0000BB">$result</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">$number_of_news </font><font color="#007700">== </font><font color="#0000BB">0</font><font color="#007700">) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">false</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">true</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /> }<br /></font><font color="#FF8000">//Returns the array of modules.<br /></font><font color="#007700">function </font><font color="#0000BB">list_modules</font><font color="#007700">()<br /> {<br />&nbsp;&nbsp;</font><font color="#0000BB">$connection </font><font color="#007700">= </font><font color="#0000BB">db_connect</font><font color="#007700">();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;</font><font color="#0000BB">$query </font><font color="#007700">= </font><font color="#DD0000">'SELECT * FROM modules WHERE system = 0'</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result </font><font color="#007700">= </font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$query</font><font color="#007700">);<br />&nbsp;&nbsp;</font><font color="#FF8000">//Checking Whether the Result is Empty.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$number_of_news </font><font color="#007700">= </font><font color="#0000BB">mysql_num_rows</font><font color="#007700">(</font><font color="#0000BB">$result</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">$number_of_news </font><font color="#007700">== </font><font color="#0000BB">0</font><font color="#007700">) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">false</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result </font><font color="#007700">= </font><font color="#0000BB">result_to_array</font><font color="#007700">(</font><font color="#0000BB">$result</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">$result</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /> }<br />function </font><font color="#0000BB">list_modules_menu</font><font color="#007700">()<br /> {<br />&nbsp;&nbsp;</font><font color="#0000BB">$connection </font><font color="#007700">= </font><font color="#0000BB">db_connect</font><font color="#007700">();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;</font><font color="#0000BB">$query </font><font color="#007700">= </font><font color="#DD0000">'SELECT * FROM modules WHERE show_menu = 1'</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result </font><font color="#007700">= </font><font color="#0000BB">mysql_query</font><font color="#007700">(</font><font color="#0000BB">$query</font><font color="#007700">);<br />&nbsp;&nbsp;</font><font color="#FF8000">//Checking Whether the Result is Empty.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$number_of_news </font><font color="#007700">= </font><font color="#0000BB">mysql_num_rows</font><font color="#007700">(</font><font color="#0000BB">$result</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">$number_of_news </font><font color="#007700">== </font><font color="#0000BB">0</font><font color="#007700">) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">false</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result </font><font color="#007700">= </font><font color="#0000BB">result_to_array</font><font color="#007700">(</font><font color="#0000BB">$result</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return </font><font color="#0000BB">$result</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /> }<br /> </font><font color="#FF8000">//Load template.<br /></font><font color="#007700">function </font><font color="#0000BB">load_template</font><font color="#007700">(</font><font color="#0000BB">$module</font><font color="#007700">,</font><font color="#0000BB">$view</font><font color="#007700">)<br />{<br /> if (</font><font color="#0000BB">file_exists</font><font color="#007700">(</font><font color="#0000BB">TEMPLATE_PATH</font><font color="#007700">.</font><font color="#DD0000">'modules/'</font><font color="#007700">.</font><font color="#0000BB">$module</font><font color="#007700">.</font><font color="#DD0000">'/'</font><font color="#007700">.</font><font color="#0000BB">$view</font><font color="#007700">.</font><font color="#DD0000">'.php'</font><font color="#007700">))<br /> { include_once(</font><font color="#0000BB">TEMPLATE_PATH</font><font color="#007700">.</font><font color="#DD0000">'modules/'</font><font color="#007700">.</font><font color="#0000BB">$module</font><font color="#007700">.</font><font color="#DD0000">'/'</font><font color="#007700">.</font><font color="#0000BB">$view</font><font color="#007700">.</font><font color="#DD0000">'.php'</font><font color="#007700">);}<br />elseif (</font><font color="#0000BB">file_exists</font><font color="#007700">(</font><font color="#0000BB">TEMPLATE_PATH</font><font color="#007700">.</font><font color="#DD0000">'modules/'</font><font color="#007700">.</font><font color="#0000BB">$module</font><font color="#007700">.</font><font color="#DD0000">'/index.php'</font><font color="#007700">))<br /> { include_once(</font><font color="#0000BB">TEMPLATE_PATH</font><font color="#007700">.</font><font color="#DD0000">'modules/'</font><font color="#007700">.</font><font color="#0000BB">$module</font><font color="#007700">.</font><font color="#DD0000">'/index.php'</font><font color="#007700">);}<br />elseif (</font><font color="#0000BB">file_exists</font><font color="#007700">(</font><font color="#0000BB">TEMPLATE_PATH</font><font color="#007700">.</font><font color="#DD0000">'index.php'</font><font color="#007700">))<br /> { include_once(</font><font color="#0000BB">TEMPLATE_PATH</font><font color="#007700">.</font><font color="#DD0000">'index.php'</font><font color="#007700">);}<br />elseif (</font><font color="#0000BB">file_exists</font><font color="#007700">(</font><font color="#0000BB">SERVER_ROOT</font><font color="#007700">.</font><font color="#0000BB">APP_ROOT</font><font color="#007700">.</font><font color="#DD0000">'/templates/oslite/modules/'</font><font color="#007700">.</font><font color="#0000BB">$module</font><font color="#007700">.</font><font color="#DD0000">'/'</font><font color="#007700">.</font><font color="#0000BB">$view</font><font color="#007700">.</font><font color="#DD0000">'.php'</font><font color="#007700">))<br /> { include_once(</font><font color="#0000BB">SERVER_ROOT</font><font color="#007700">.</font><font color="#0000BB">APP_ROOT</font><font color="#007700">.</font><font color="#DD0000">'/templates/oslite/modules/'</font><font color="#007700">.</font><font color="#0000BB">$module</font><font color="#007700">.</font><font color="#DD0000">'/'</font><font color="#007700">.</font><font color="#0000BB">$view</font><font color="#007700">.</font><font color="#DD0000">'.php'</font><font color="#007700">);}<br />elseif (</font><font color="#0000BB">file_exists</font><font color="#007700">(</font><font color="#0000BB">SERVER_ROOT</font><font color="#007700">.</font><font color="#0000BB">APP_ROOT</font><font color="#007700">.</font><font color="#DD0000">'/templates/oslite/modules/'</font><font color="#007700">.</font><font color="#0000BB">$module</font><font color="#007700">.</font><font color="#DD0000">'/'</font><font color="#007700">.</font><font color="#DD0000">'index.php'</font><font color="#007700">))<br /> { include_once(</font><font color="#0000BB">SERVER_ROOT</font><font color="#007700">.</font><font color="#0000BB">APP_ROOT</font><font color="#007700">.</font><font color="#DD0000">'/templates/oslite/modules/'</font><font color="#007700">.</font><font color="#0000BB">$module</font><font color="#007700">.</font><font color="#DD0000">'/'</font><font color="#007700">.</font><font color="#DD0000">'index.php'</font><font color="#007700">);}<br />elseif (</font><font color="#0000BB">file_exists</font><font color="#007700">(</font><font color="#0000BB">SERVER_ROOT</font><font color="#007700">.</font><font color="#0000BB">APP_ROOT</font><font color="#007700">.</font><font color="#DD0000">'/templates/oslite/index.php'</font><font color="#007700">))<br /> { include_once(</font><font color="#0000BB">SERVER_ROOT</font><font color="#007700">.</font><font color="#0000BB">APP_ROOT</font><font color="#007700">.</font><font color="#DD0000">'/templates/oslite/index.php'</font><font color="#007700">);}<br />else<br /> { include_once(</font><font color="#0000BB">ERROR_PAGE</font><font color="#007700">);}<br />}<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div></div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=3">Newbies</category>
			<dc:creator>mike2234</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384483</guid>
		</item>
		<item>
			<title>json_encode not wrapping double quotes around column names</title>
			<link>http://www.phpbuilder.com/board/showthread.php?t=10384482&amp;goto=newpost</link>
			<pubDate>Tue, 15 May 2012 16:00:22 GMT</pubDate>
			<description><![CDATA[
PHP:
---------
<?php
   $route = intval($_GET['route']);
   
   $link = mssql_connect('localhost\SQLEXPRESS','***','*********') or die("Couldn't connect to SQL Server on $myServer. Error: " . mssql_get_last_message());
   mssql_select_db('PDQ',$link) or die('Cannot select the DB');
   
   $query = "SELECT * FROM CUSTOMER WHERE CUS_ROUTE = $route";
   $result = mssql_query($query,$link) or die('Errant query:  '.$query);
   
   $rows = array();
   while($row = mssql_fetch_assoc($result)) {
      $rows[] = $row;
   }
   echo json_encode($rows);

   
   @mssql_close($link);
?>
---------
My Result is:

[
{
CUS_DLT: 2,
CUS_COMPANY: 1,
CUS_CUSTOMSTRING2: "TIMES MARKET # 9"
},
{
CUS_DLT: 2,
CUS_COMPANY: 1
CUS_CUSTOMSTRING2: "TIMES MARKET # 8"
}
]

However this is not a valid json_encode because the column names are not wrapped in ". Does anyone know why or how to fix this?]]></description>
			<content:encoded><![CDATA[<div><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">&lt;?php<br />&nbsp;&nbsp;&nbsp;$route </font><font color="#007700">= </font><font color="#0000BB">intval</font><font color="#007700">(</font><font color="#0000BB">$_GET</font><font color="#007700">&#91;</font><font color="#DD0000">'route'</font><font color="#007700">&#93;);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$link </font><font color="#007700">= </font><font color="#0000BB">mssql_connect</font><font color="#007700">(</font><font color="#DD0000">'localhost\SQLEXPRESS'</font><font color="#007700">,</font><font color="#DD0000">'***'</font><font color="#007700">,</font><font color="#DD0000">'*********'</font><font color="#007700">) or die(</font><font color="#DD0000">"Couldn't connect to SQL Server on $myServer. Error: " </font><font color="#007700">. </font><font color="#0000BB">mssql_get_last_message</font><font color="#007700">());<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">mssql_select_db</font><font color="#007700">(</font><font color="#DD0000">'PDQ'</font><font color="#007700">,</font><font color="#0000BB">$link</font><font color="#007700">) or die(</font><font color="#DD0000">'Cannot select the DB'</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$query </font><font color="#007700">= </font><font color="#DD0000">"SELECT * FROM CUSTOMER WHERE CUS_ROUTE = $route"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$result </font><font color="#007700">= </font><font color="#0000BB">mssql_query</font><font color="#007700">(</font><font color="#0000BB">$query</font><font color="#007700">,</font><font color="#0000BB">$link</font><font color="#007700">) or die(</font><font color="#DD0000">'Errant query:&nbsp;&nbsp;'</font><font color="#007700">.</font><font color="#0000BB">$query</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$rows </font><font color="#007700">= array();<br />&nbsp;&nbsp;&nbsp;while(</font><font color="#0000BB">$row </font><font color="#007700">= </font><font color="#0000BB">mssql_fetch_assoc</font><font color="#007700">(</font><font color="#0000BB">$result</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$rows</font><font color="#007700">&#91;&#93; = </font><font color="#0000BB">$row</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;echo </font><font color="#0000BB">json_encode</font><font color="#007700">(</font><font color="#0000BB">$rows</font><font color="#007700">);<br /><br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;@</font><font color="#0000BB">mssql_close</font><font color="#007700">(</font><font color="#0000BB">$link</font><font color="#007700">);<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code><!-- php buffer end -->
		</div>
		</code>
		<hr />
	</div>
</div>My Result is:<br />
<br />
[<br />
{<br />
CUS_DLT: 2,<br />
CUS_COMPANY: 1,<br />
CUS_CUSTOMSTRING2: &quot;TIMES MARKET # 9&quot;<br />
},<br />
{<br />
CUS_DLT: 2,<br />
CUS_COMPANY: 1<br />
CUS_CUSTOMSTRING2: &quot;TIMES MARKET # 8&quot;<br />
}<br />
]<br />
<br />
However this is not a valid json_encode because the column names are not wrapped in &quot;. Does anyone know why or how to fix this?</div>

]]></content:encoded>
			<category domain="http://www.phpbuilder.com/board/forumdisplay.php?f=10">Coding</category>
			<dc:creator>joel1618</dc:creator>
			<guid isPermaLink="true">http://www.phpbuilder.com/board/showthread.php?t=10384482</guid>
		</item>
	</channel>
</rss>

