Okay this is my code, i can't get the else statement part to work...can anyone kindly assist me...i find nothing wrong with the syntax...thank u...

ps: no error...

$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="testing"; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die(mysql_error());


$sql="SELECT * FROM $tbl_name WHERE invoice_no = '$invoiceno'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result) or die(mysql_error());

echo "Invoice No. found";


Hi, i think i can see your question. My advice would either be put the curly brackets in ({) and maybe change the statement to if (mysql_num_rows($result) !=0) { ...

if (mysql_num_rows($result) !=0) {
        echo "Invoice No. found";
} else {


commented: Yes +7

Replace your line 17

$row = mysql_fetch_array($result) or die(mysql_error());


$row = mysql_num_rows($result);

heyy...thanks for the reply....its still the same....its just showing a blank page when i click the submit.

the previous file, the invoice number comes from here.

<title>Shipping Cross-Check System</title>
<form method="post" name="form">
<h1>Enter your Invoice No. to create a new shipment</h1>
<td>Invoice No. :</td><td><input name="invoiceno" type="text" size"25"></input></td>
<input type="submit" name="submit" value="Back" onclick="form.action='main_login.php';"></input>
<input type="submit" name="submit" value="Submit" onclick="form.action='display.php';"></input>


hahaha...its working....thank u soo much Mr. Karthik...owe you one...

Hmmm, maybe try changing this:

$sql="SELECT * FROM $tbl_name WHERE invoice_no = '$invoiceno'";

to this:

$sql="SELECT * FROM $tbl_name WHERE invoice_no = '".$invoiceno."'";

Let me know the result.