Jump to content

Blank output problem


master82

Recommended Posts

What is wrong with this code?

[code]<?php
include("database.php");
$userstable = mysql_query("SELECT * FROM users WHERE userid = '1'");
if (!$userstable) {
  echo 'Could not run users query: ' . mysql_error();
  exit;
}
$user = mysql_fetch_row($userstable);

//testing
echo $user[userid];
echo $user[username];
?> [/code]

When I run it I donr get any errors, just a blank page ???
Link to comment
https://forums.phpfreaks.com/topic/19754-blank-output-problem/
Share on other sites

try this:

[quote]<?php
include("database.php");
$userstable = mysql_query("SELECT * FROM users WHERE userid = '1'");
if (!$userstable) {
  echo 'Could not run users query: ' . mysql_error();
  exit;
}
$user = mysql_fetch_row($userstable);

//testing
echo $user[0];
echo $user[1];
?> [/quote]

you may need to edit the numbers to match the colum number.
Also RTFM [url=http://uk.php.net/manual/en/function.mysql-fetch-row.php]http://uk.php.net/manual/en/function.mysql-fetch-row.php[/url]
Link to comment
https://forums.phpfreaks.com/topic/19754-blank-output-problem/#findComment-86264
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.