rawky1976 Posted February 8, 2007 Share Posted February 8, 2007 A few replies to my posts have said why do your use sprintf, what other ways are there???? $insertSQL = sprintf("INSERT INTO... Mark Link to comment https://forums.phpfreaks.com/topic/37669-sql-insert-method/ Share on other sites More sharing options...
papaface Posted February 8, 2007 Share Posted February 8, 2007 $insertSQL = mysql_query("INSERT INTO... Link to comment https://forums.phpfreaks.com/topic/37669-sql-insert-method/#findComment-180173 Share on other sites More sharing options...
rawky1976 Posted February 8, 2007 Author Share Posted February 8, 2007 and that just works or does it have to be defined??? I assume that dreamweaver adds the sprintf as part of its inbuilt coding methods, and thats why you all wonder about it? (Everyone that posts it is using DW!!)? Link to comment https://forums.phpfreaks.com/topic/37669-sql-insert-method/#findComment-180177 Share on other sites More sharing options...
Hypnos Posted February 8, 2007 Share Posted February 8, 2007 With sprintf you can specify data types, which can help with injection where number inputs are expected and quotes are not used. mysql_query is not a replacement for sprintf. It's the next step in the process. Link to comment https://forums.phpfreaks.com/topic/37669-sql-insert-method/#findComment-180179 Share on other sites More sharing options...
rawky1976 Posted February 8, 2007 Author Share Posted February 8, 2007 OK, i just swapped sprintf for mysql_query and got: - Query was empty displayed on page. Assume I need to extend the code, do you need me to post it? Link to comment https://forums.phpfreaks.com/topic/37669-sql-insert-method/#findComment-180180 Share on other sites More sharing options...
Hypnos Posted February 8, 2007 Share Posted February 8, 2007 mysql_query is not a replacement for sprintf. Link to comment https://forums.phpfreaks.com/topic/37669-sql-insert-method/#findComment-180198 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.