Re: Returns Blank

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

 



On Thu, 20 Jan 2005 14:20, 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");
> 
> $query = "SELECT credits FROM krypto WHERE user = '" . $user . "' AND
> pass = '" . $pass . "'";
> $result = mysql_query($query);
> 
> 
> if (!$result) {
>    echo 'Could not run query: ' . mysql_error();
>    exit;
> }
> echo mysql_result($result, 3);
> 
> mysql_free_result($result);
> 
> mysql_close();

A couple of possibilities come to mind; there is no matching record and
therefore no output; there is a matching record but because you have
selected one field and asked for the fourth field there is no output.

Try checking the number of rows returned to see if the is in fact a matching
row, and try echoing some text to ensure there is output to the browser.
Also a check of the document source might help.

-- 
David Robley

"This steamroller really works," said Tom flatteringly.

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