PHP Classes

Secure query

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Secure query  
Subject:Secure query
Summary:Is there a difference between...
Messages:2
Author:Mat Patnik
Date:2010-11-07 00:16:43
Update:2010-11-07 04:52:41
 

  1. Secure query   Reply   Report abuse  
Picture of Mat Patnik Mat Patnik - 2010-11-07 04:51:57
Is there a difference as far as security between the 2:

$query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s' LIMIT 1;",
mysql_real_escape_string($user),
mysql_real_escape_string($password));

And

$query = "SELECT *
FROM members
WHERE username = '". mysql_real_escape_string($_SESSION['username']) ."'
AND password = '". mysql_real_escape_string($_SESSION['password']) ."'
LIMIT 1;";

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.