Re: Returns Blank
| From: | David Robley | Date: | Thu, 20 Jan 2005 09:10:07 +0000 |
| Subject: | Re: Returns Blank | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38227@lists.php.net to get a copy of this message | ||
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.