Re: Why does query work in MySQL but not in PHP doc

From: Date: Sun, 09 Jul 2000 19:53:26 +0000
Subject: Re: Why does query work in MySQL but not in PHP doc
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-5628@lists.php.net to get a copy of this message
On Sat, 08 Jul 2000, Fates wrote: > > I am using two tables within one database and want to query both tables: > > When I type this line in MySQL program it works: > SELECT * from albums, songs WHERE albums.AlbumID = 2 and songs.albumid = 2 and albums.album = > "Collection"; > > When I try and use this with php form I get nothing > $query = "SELECT * FROM albums, songs WHERE albums.AlbumID = 2 and songs.albumid = 2 and > albums.album = "Collection"; > $result = mysql_db_query("musicdb", $query); I would have done it this way: $query = "SELECT * FROM albums, songs WHERE albums.AlbumID = 2 and songs.albumid = 2 and albums.album = \"Collection\"; $result = mysql_db_query("musicdb", $query); Check the " being escaped with \ (backslashs) Luck!!! -- "And I'm happy, because you make me feel good, about me." - Melvin Udall ----------------------------------------------------------------- Martín Marqués email: martin@math.unl.edu.ar Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------

« previous php.general (#5628) next »