Re: Returns Blank

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

 



Squeakypants wrote:
I can't figure this out, it just shows blank...
$user=$_POST['user'];
$pass=$_POST['pass'];

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

You're suppressing the error returned from mysql_select_db with the @ symbol. Remove it and you'll get something useful - but you'd do better to put the die on the mysql_connect and return mysql's error message.


$query = "SELECT credits FROM krypto WHERE user = '" . $user . "' AND
pass = '" . $pass . "'";

Just as a point of information, you don't need to break out of your quoting to add the variables here:


$query = "SELECT credits FROM krypto WHERE user = '$user' AND pass = '$pass'";

will work fine. Variables embedded in double quotes are expanded - though with arrays you will need to enclose them in {$curlies['foo']}.

Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux