geroid Posted April 27, 2009 Share Posted April 27, 2009 Hi I'm using the following code to insert a record: $insert = mysql_query("insert into $table (event_name, venue_name, streetaddress1, streetaddress2, town, event_description, event_date, event_time) values ('" .$_SESSION['evname']. "', '".$_SESSION['venuename']."', '".$_SESSION['addr1']."', '".$_SESSION['addr2']."', '".$_SESSION['town']."', '".$_SESSION['content']."', '".$_SESSION['fulldate']."', '".$_SESSION['time']."',)") or die("Could not insert data because ".mysql_error());?> Can anyone tell me how to display the contents of the sql statement on the webpage so I can see that it is correct? Link to comment https://forums.phpfreaks.com/topic/155824-how-to-display-the-sql-statement-contents/ Share on other sites More sharing options...
nankoweap Posted April 27, 2009 Share Posted April 27, 2009 have you tried? print($insert); Link to comment https://forums.phpfreaks.com/topic/155824-how-to-display-the-sql-statement-contents/#findComment-820206 Share on other sites More sharing options...
mtoynbee Posted April 27, 2009 Share Posted April 27, 2009 echo $query = "insert into $table (event_name, venue_name, streetaddress1, streetaddress2, town, event_description, event_date, event_time) values ('" .$_SESSION['evname']. "', '".$_SESSION['venuename']."', '".$_SESSION['addr1']."', '".$_SESSION['addr2']."', '".$_SESSION['town']."', '".$_SESSION['content']."', '".$_SESSION['fulldate']."', '".$_SESSION['time']."',)"; $insert = mysql_query($query) or die("Could not insert data because ".mysql_error()); Link to comment https://forums.phpfreaks.com/topic/155824-how-to-display-the-sql-statement-contents/#findComment-820208 Share on other sites More sharing options...
geroid Posted April 27, 2009 Author Share Posted April 27, 2009 Thanks for that. Worked well Link to comment https://forums.phpfreaks.com/topic/155824-how-to-display-the-sql-statement-contents/#findComment-820232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.