I have a query running at the moment, and for the sake of trying to figure it out, I left it in the same format as a SELECT query that I got from an example somewhere along the line.
Code: Select all
$sql = "INSERT INTO `member_auth` (`ID`, `Username`, `Password`) VALUES ('', 'Test', 'test')";
if(!($result = mysql_query($sql))) die(mysql_error());
I guess what I am wondering is, is this going to catch any errors of data not being inserted into the database? I have looked around and people seem to just be going something like ...
Code: Select all
$sql = "INSERT INTO `member_auth` (`ID`, `Username`, `Password`) VALUES ('', 'Test', 'test')";
mysql_query($sql)
if (mysql_affected_rows() < 1) $Output .= '<li>Database Error!</li>';
Are they pretty much the same? Is one preferable to the other? Is there a better way?
Any help here would be great. Thanks