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
https://forums.phpfreaks.com/topic/244698-error-message/
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
https://forums.phpfreaks.com/topic/244698-error-message/#findComment-1256845
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
https://forums.phpfreaks.com/topic/244698-error-message/#findComment-1256854
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
https://forums.phpfreaks.com/topic/244698-error-message/#findComment-1256869
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.