Posting data from Database
<p>I am validating a form (checking if field are empty etc and at the end I am using my last validation rule:</p>

<pre><code>//Database Information
//Connect to database

mysql_connect($dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname)or die(mysql_error());

$email = mysql_real_escape_string($_POST['email']);
$cust_code = mysql_real_escape_string($_POST['cust_code']);

//validation e.g.
if (empty($email) + empty($cust_code) &gt; 1){
....

//if everything is ok
$sql = "SELECT * FROM clients WHERE ID='$cust_code'";
$result = mysql_query($sql);
if(mysql_num_rows($result) &gt; 0){
$data = mysql_num_rows($result);

//get all fields from db and do something

}else{
//My error that is showing up
echo "&lt;span class=\"difftext\"&gt;The customer code you have entered is not valid!
&lt;br /&gt;
Please enter a valid Customer Code to procceed!
&lt;/span&gt;";
</code></pre>

<p>Is anything wrong with that because even if I enter the correct cust_code I am getting my error msg instead of my data...</p>

<p>Thank you</p>

<p>EDIT...(I removed, as it is wrong) AND YOU DID WELL... I JUST REALISE WHAT I DID... SORRY...</p>

<p>I have corrected it above.</p>

<p>Thank you</p>
