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" <[EMAIL PROTECTED]> 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
> 
> 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to