alternative error messages

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
spitfire_esquive
Forum Commoner
Posts: 37
Joined: Sun Nov 06, 2005 6:46 am

alternative error messages

Post by spitfire_esquive »

Code: Select all

$result=mysql_query($pasok);

if ($result) {
      echo mysql_affected_rows().' Recorded.';
    }
    else{
      echo "Record not saved.";
      exit;
    }
hello i have the above code. can you guys suggest a function/command that would give me a specific error if the record is "Record not saved". it is from a web database application that i'm trying to develop and sometimes the "Record not saved" error comes out. presently i am looking to see if it has anything to do with how my mysql database is structured.

thanks in advance! :D
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

mysql_errno -- Returns the numerical value of the error message from previous MySQL operation
mysql_error -- Returns the text of the error message from previous MySQL operation

http://www.php.net/manual/en/ref.mysql.php
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: alternative error messages

Post by Jenk »

spitfire_esquive wrote:

Code: Select all

$result=mysql_query($pasok);

if ($result) {
      echo mysql_affected_rows($result).' Recorded.';
    }
    else{
      echo "Record not saved.";
      exit;
    }
fixed..
Post Reply