Caps Posted October 4, 2006 Share Posted October 4, 2006 Is it allowed to have more than one SQL statements (SELECT and DELETE) in one mysql_query() method? Or must you have two mysql_query methods to it? If the user posts something you want to set into your database, will they could finished the insert statement and execute a drop and delete statement in the same mysql_query method?Like:site.php?id = ....$id = "'; DELETE FROM users WHERE id = 1" //user changed variablemysql_query("SELECT navn FROM users WHERE id = '$id'")The above code does not work, but I hope you got the idea of it. Is it possible in any way? Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted October 4, 2006 Share Posted October 4, 2006 One query at a time. Quote Link to comment Share on other sites More sharing options...
trq Posted October 4, 2006 Share Posted October 4, 2006 I believe mysql5 may handle multiple queries seperated by colons. Not 100% sure though.. havent used mysql in a long time. Quote Link to comment Share on other sites More sharing options...
JaGeK Posted October 4, 2006 Share Posted October 4, 2006 [quote author=thorpe link=topic=110490.msg446801#msg446801 date=1159985951]I believe mysql5 may handle multiple queries seperated by colons.[/quote]As far as I know, there is no difference how mysql_query() behaves depending on the MySQL version. One query is allowed, not more. Quote Link to comment 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.