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. Quote 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? Quote 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()); Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.