[thelist] syntax for mysql_query

Nan Harbison nan at nanharbison.com
Wed Apr 23 09:28:30 CDT 2008


Hi folks,
 
I was using this syntax for queries to the db:
 
$query = blah blah blah;
$results= mysql_query($query, $db_connection) or die (mysql_error()); 
 
This works sometimes, in fact, it seems to work and then later now work, and
then it throws an error, so I end up removing $db_connection and then it
works.
$results= mysql_query($query) or die (mysql_error()); 
Can someone tell me why sometimes this works and sometimes not?
I googled it and didn't find anything helpful. I am not a db pro, obviously
but I have ended up doing lots of queries recently.
 
Does this only work in some types of query - INSERT vs SELECT or DELETE or
something?
 
TIA
Nan



More information about the thelist mailing list