Re: Select and $_POST

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

 



On Wed, Nov 09, 2005 at 11:21:36PM -0000, Ross wrote:
> 
> What is the correct syntax for
> 
> $query = "SELECT * FROM login where username='$_POST['username']' AND pass 
> ='$_POST['pass']'";
> 

<?php
if (get_magic_quotes_gpc()) {
  $_POST['username'] = stripslashes($_POST['username']);
  $_POST['pass'] = stripslashes($_POST['pass']);
}

/* where dbdriver is mysql[_real] or pg, etc.. */
$username = dbdriver_escape_string($_POST['username']);
$pass = dbdriver_escape_string($pass);

$query = "SELECT * FROM login 
  WHERE username = '$username' AND pass = '$pass'";


Curt.
-- 

-- 
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