mysql_query($query) returns mysql_errno 0.
am 14.09.2007 21:58:25 von Thaddius39Hey all;
I'm one of those newbies to the PHP realm of programming and I've run
into a stumper. What I'm trying to do is pull data (any data at this
point) from a mysql database. I've checked and doublechecked by my
code and cross referenced examples on the Web, but I cannot seem to
find anything that might give me some incite.
Below is a code snippet showing what I'm trying to accomplish.
$connection = mysql_connect('localhost', 'user', 'pass');
if(!$connection)
{
die ("Could not connect to the database: \n".
mysql_error());
}
elseif($connection)
{
print "Successfully connected to the database \n";
}
$db_select = mysql_select_db('self_serv');
if(!$db_select)
{
die ("Could not select the database: \n".
mysql_error());
}
elseif($db_select)
{
print "Successfully selected the database \n";
}
$select = 'SELECT';
$column = '*';
$from = 'FROM';
$tables = 'app_n_port';
$where = 'WHERE app_no=1001';
$query = $select." ".$column." ".$from." ".$tables." ".$where. " LIMIT
0, 30";
$result = mysql_query($query);
if (!$result);
{
die ("Query failed. Your Query: " . $query . "
Returned Error Number: " ." ".mysql_errno() . " Error Detail-> " . m
ysql_error()). "\n";
}
while ($result_row = mysql_fetch_array($result))
{
echo $result_row. "\n";
}
mysql_close($connection);
?>
After running the script I get the "die" statement after the
Any help would be greatly appreciated.
Thanks in advance,
Thad