Gayner Posted November 29, 2009 Share Posted November 29, 2009 $id = mysql_insert_id(); header("Location: ./?view=$id"); Why $id pulling blank nothing? mysql_query("INSERT INTO `prays` (`title`,`prayer`,`time`,`level`,`nameid`,`name`) VALUES ( '". mysql_real_escape_string($_POST['title']) ."', '". mysql_real_escape_string($text) ."', '". mysql_real_escape_string($time) ."', '". mysql_real_escape_string($_POST['level']) ."', '". mysql_real_escape_string($e) ."', '". mysql_real_escape_string($name) ."');") or die(mysql_error()) ; mysql_close(); $id = mysql_insert_id(); header("Location: ./?view=$id"); Quote Link to comment https://forums.phpfreaks.com/topic/183279-mysql-insert-id-not-working/ Share on other sites More sharing options...
Alex Posted November 29, 2009 Share Posted November 29, 2009 Call mysql_close() after $id = mysql_insert_id(); Quote Link to comment https://forums.phpfreaks.com/topic/183279-mysql-insert-id-not-working/#findComment-967345 Share on other sites More sharing options...
Gayner Posted November 29, 2009 Author Share Posted November 29, 2009 Call mysql_close() after $id = mysql_insert_id(); ic ic Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/183279-mysql-insert-id-not-working/#findComment-967346 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.