Jump to content

error message


esoteric

Recommended Posts

hi guys, this is probably simple but i couldn't find any posts about it.

 

I have a form that displays some details if the right info has been typed in, if it's wrong info or if the fields have been left blank how can i display some sort of message like ''Invoice data could not be found, please check you details and try again''

 

At the moment, if you type the details in wrong it the page is just empty.

 

thank you.

Link to comment
Share on other sites

It a quite a large page but the start part is

 

.....
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname) or die (" Cannot find database");

$sql = "SELECT * FROM orderTable WHERE orderNum = '". $order ."' AND custUsername = '". $username ."' AND custPassword = '". $userpass ."'" or die ("Cannot find table");

$query = mysql_query($sql);

while ($row = mysql_fetch_array($query)) { 
?>
<html>
<head>
....

If the 'custUsername', 'custPassword', or 'orderNum' is wrong i need it to display the error.

 

Thanks

 

Link to comment
Share on other sites

I'm asking for help, i been trying different things i found on the internet but none of them work or are too confusing to understand.

 

Say the order number was typed in wrong then it would display ''Order Number not found''

 

If the order number exists but the username is wrong; '' Username incorrect''

 

If the order number exists but the password is wrong; ''Password incorrect''

 

Thanks for your patience.

Link to comment
Share on other sites

.....
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname) or die (" Cannot find database");

$sql = "SELECT * FROM orderTable WHERE orderNum = '". $order ."' AND custUsername = '". $username ."' AND custPassword = '". $userpass ."'" or die ("Cannot find table");

$query = mysql_query($sql);


if(mysql_num_rows($query) < 1) {
echo "<h1>Error Status</h1>";
echo "Error!";
}

while ($row = mysql_fetch_array($query)) { 
?>
<html>
<head>
....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.