Re: SQL Select?

From: Date: Sun, 25 Mar 2001 01:47:29 +0000
Subject: Re: SQL Select?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7766@lists.php.net to get a copy of this message
Grant, $link_id = mysql_connect($host, $usr, $pass) or die (mysql_error()); mysql_select_db($database, $link_id); $sql="select fields from $table where criteria = $value"; $result = mysql_query($sql, $link_id) or die ("no results"); //return result set to php you still need to do something with $result. also, if you use mysql_fetch_array instead of mysql_query, you get a row-matched array. Best regards, Andrew --------------------------------------- Andrew Hill - OpenLink Software Director Technology Evangelism Virtuoso, eBusinss iNtegration http://www.openlinksw.com/virtuoso On 3/24/01 3:55 PM, "Grant" <gb@NOSPAMgbarrie.net> wrote: > Hello all > > Is there any way of using a string in an SQL query instead of using the > table name. Something along the lines of > > $result=mysql_query("SELECT * FROM $tablename",$db); > > this doesnt work it come up with a parse error > > thankyou > > Grant > >

« previous php.db (#7766) next »