marklarah Posted January 19, 2008 Share Posted January 19, 2008 mysql_query("INSERT INTO topics (ID, Name, CBy, Last_post, Board) VALUES(NULL, '$mtit', '$usernamem', NOW(), '$boardA') ") or die(mysql_error()); mysql_query("INSERT INTO messages (messageid, topic, username, time, message, board) VALUES(NULL, 'its here i need to find out that null value entered', '$usernamem', NOW(), '$mcont', '$boardA') ") or die(mysql_error()); So how do i find out that NULL value inserted in the first query to inert into the second one? Its auto_increment the ID field. thanks. Link to comment https://forums.phpfreaks.com/topic/86838-solved-finding-out-a-null-value/ Share on other sites More sharing options...
marklarah Posted January 19, 2008 Author Share Posted January 19, 2008 is there some super-secret special NULL variable only known to everyone but me? Link to comment https://forums.phpfreaks.com/topic/86838-solved-finding-out-a-null-value/#findComment-443805 Share on other sites More sharing options...
wildteen88 Posted January 20, 2008 Share Posted January 20, 2008 if you are listing your fields in your query, then you can remove the fields which will receive a null value. mysql_query("INSERT INTO topics (Name, CBy, Last_post, Board) VALUES('$mtit', '$usernamem', NOW(), '$boardA') ") or die(mysql_error()); mysql_query("INSERT INTO messages (topic, username, time, message, board) VALUES('its here i need to find out that null value entered', '$usernamem', NOW(), '$mcont', '$boardA') ") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/86838-solved-finding-out-a-null-value/#findComment-444425 Share on other sites More sharing options...
papaface Posted January 20, 2008 Share Posted January 20, 2008 http://uk3.php.net/manual/en/function.mysql-insert-id.php is what you want. Link to comment https://forums.phpfreaks.com/topic/86838-solved-finding-out-a-null-value/#findComment-444427 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.