Re: [PHP] syntax of sprintf

2008-05-20 Thread Chris
> the select query is > > $selectqueryusername = sprintf("Select username from individuals where > username='%s'", mysql_real_escape_string($username)); The syntax is fine. $result = mysql_query($selectqueryusername); if (!$result) { echo "Error! *** " . mysql_error(); } > also for insert q

[PHP] syntax of sprintf

2008-05-20 Thread Sudhakar
until i started using the techniques for avoiding sql injection, i have been using a normal insert and select sql query which worked fine. i have a registration page where a user enters their username and if this already exists i display a message by executing a select query and if the username doe

Re: [PHP] syntax of sprintf

2008-05-18 Thread Ólafur Waage
Try this one $sSQL = sprintf("SELECT username FROM individuals WHERE username='%s'", mysql_real_escape_string($username)); $query = mysql_query($sSQL); if($query !== false) { // do something } 2008/5/18 Sudhakar <[EMAIL PROTECTED]>: > until i started using the techniques for avoiding sql injectio

[PHP] syntax of sprintf

2008-05-18 Thread Sudhakar
until i started using the techniques for avoiding sql injection, i have been using a normal insert and select sql query which worked fine. i have a registration page where a user enters their username and if this already exists i display a message by executing a select query and if the username do