Re: syntax of sprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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 query if i have a numeric value i should be writting %d
> correct, i have a numeric value however before inserting that
> numeric value i am appending a character "-" to combine area code and phone
> number example 09-123 4567 so i am considering this as %s as there is a
> character. is this correct.

Yes.

The placeholders are all documented pretty well:

http://www.php.net/sprintf

-- 
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux