I think I've fixed it but in an odd way. Apparently I was getting error
1046: no database seleted. So I ran mysql_db_query and that worked. But
on the other pages I have, mysql_query always works. I have a function
called connect() that I run on every page:

function connect()
{
global $DB_SERVER, $DB_LOGIN, $DB_PASSWORD;
if (@mysql_pconnect($DB_SERVER, $DB_LOGIN, $DB_PASSWORD))
{
return 1;
}
else
header("Location: blahblahblah");
}

This should establish a permanent connection to the database server. Is
there a way to permanatly select a certain database?

Pat

-----Original Message-----
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 05, 2004 3:20 PM
To: Pat Hanna; php help
Subject: RE: [PHP] Strange coding bug


[snip]
$query="SELECT * FROM products WHERE stock_number = '$item_number'";
$result=mysql_query($query); $row=mysql_fetch_array($result);

When I do 'echo $result;' on the first page, I get the result number.
[/snip]

If you 

echo $result;

with this code all you should get back is 'array' ($result is an array)
Do this

print_r($row) and see what happens.

P.S. Attachements are stripped on the way to the list usually, so post
the relevant small bits of code in your e-mail.

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

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

Reply via email to