Re: Shot in the dark

From: Date: Sat, 06 Jul 2002 20:14:47 +0000
Subject: Re: Shot in the dark
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-102592@lists.php.net to get a copy of this message
Chris, Thanks. I know mysql4.x is ALPHA, but I am getting a lot of flack for not having "a more comprehensive boolean search available on the site" (phooey). So I am experimentin' today with an alternative installation, practising some new code - and got stumped here :o) My SQL queries I send to MySQL (using PHPMyAdmin) all worked, so I don't think it was MySQL4 ??? Works: select * from ccl_main where AU like 'Atwood, Margaret' order by AU desc Works: SELECT * FROM ccl_main WHERE MATCH (AU) AGAINST ('Atwood, Margaret' IN BOOLEAN MODE) order by AU desc I added: if(!$news) die(mysql_error()); and it tells me there is something wrong with my input? - You have an error in your SQL syntax near ' Margaret order by AU desc' at line 1 I give up. I will reinstall the previous image and leave well enough alone for another 6 months. J Knipe wrote: > use something like > > if (mysql_num_rows($news) > ) { > > to see if mysql actually returned any data before you try to use the data in > PHP. A note of caution, mysql4.x is ALPHA... There may be allot of problems > with it still. > > mysql_error() may also be a very handy function to you. > > ----- Original Message ----- > From: "jtjohnston" <taylorjo@collegesherbrooke.qc.ca> > To: <php-general@lists.php.net> > Sent: Saturday, July 06, 2002 9:59 PM > Subject: [PHP] Shot in the dark > > > MySQL4 installation. I don't get this. One mysql_query works, the other > > 2 don't. What did I mess up in my PHP syntax? > > The SQL queries all work. > > > > $au ="Atwood, Margaret"; > > $id ="1624"; > > > > THIS WORKS: > > $news = mysql_query('select * from '.$table.' where id like > > '.$id.' > > order by AU desc'); > > > > This gives "Warning: Supplied argument is not a valid MySQL result > > resource ... on line 48": > > $news = mysql_query('select * from '.$table.' where AU like > > '.$au.' > > order by AU desc'); > > #SQL-Query works: select * from ccl_main where AU like 'Atwood, > > Margaret' order by AU desc > > > > This gives "Warning: Supplied argument is not a valid MySQL result > > resource ... on line 48": > > $news = mysql_query('SELECT * FROM '.$table.' WHERE MATCH (AU) AGAINST > > ('.$au.' IN BOOLEAN MODE) order by AU desc`'); > > #SQL-Query works: SELECT * FROM ccl_main WHERE MATCH (AU) AGAINST > > ('Atwood, Margaret' IN BOOLEAN MODE) order by AU desc > > > > while ($mydata = mysql_fetch_object($news)) <----- this is line > > 48 > > { > > $mycounter++; > > echo $mydata->id." - ".$mydata->AU."<hr>"; > > } > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

« previous php.general (#102592) next »