Re: [PHPLIB] Importing Users: moderately urgent. From: Chester McLaughlin (chester23 <email protected>)
Date: 01/31/00

$db->query(sprintf("SELECT * FROM %s WHERE name_first = '%s' AND
name_last = '%s'", $table_name, $firstname, $lastname));

Try using sprintf like shown above (the definitions and instructions
on when to use %s or %d or whatnot are in the Docs.

>I need to create a variable to hold the name of a table column. How do I use
>the variable in a query? For example, with a variable called
>"$current_theme", I want to do something like:
>
>mysql_query("select * from themes where name = $current_theme", $db);
>
>For reasons dictated by my purposes, I can't just type in the name of the
>column - it must go through a variable. What is the correct way to do this?
>
>Thanks...
>--
>Damien J. Moody
>Technology Coordinator
>damienm <email protected>
>
>Think about it:
>Plato was an object-oriented programmer.
>
>-
>PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
>To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
>the body, not the subject, of your message.

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.