Jump to content

SQL query within PHP (alternative)


Cosizzle

Recommended Posts

I read about this forever ago but for the life of me I cant remember where. When I query I tend to assign something to a variable then use that variable within the query.

 

Im following a tutorial and its using %s and %d as the input. Could someone shed some light on this?

 

$query = sprintf(‘INSERT INTO %sUSER (USERNAME, PASSWORD, ‘ .
‘EMAIL_ADDR, IS_ACTIVE) VALUES (“%s”, “%s”, “%s”, %d)’,
DB_TBL_PREFIX,
mysql_real_escape_string($this- > username, $GLOBALS[‘DB’]),
mysql_real_escape_string($this- > password, $GLOBALS[‘DB’]),
mysql_real_escape_string($this- > emailAddr, $GLOBALS[‘DB’]),
$this- > isActive);

Link to comment
https://forums.phpfreaks.com/topic/140577-sql-query-within-php-alternative/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.