[SOLVED] error checking

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

[SOLVED] error checking

Post by Jim_Bo »

Hi,

Should something like this work .. it only seems to prompt if there is an error in sql1 put still passes if there is an error in sql2

Code: Select all

} else {
 
$sql1 = "INSERT INTO table (..) VALUES(..";

$result1 = mysql_query($sql1);

$sql2 = "INSERT INTO table (..) VALUES('..)";

$result2 = mysql_query($sql2);


if ((!$result1) || (!result2)) {

echo 'error'; 

} else {

echo 'successs';
Thanks
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

you need to put a $ in (!$result1 || !result2)

:)
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Post by Jim_Bo »

Hi

Doh, looked over and over and over .. didnt see it

I guess a coffee break was in order

Thanks
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Happens to me all of the time.
Post Reply