Evaluate PHP var in stored sql statement?

From: Date: Fri, 24 Jan 2003 20:17:39 +0000
Subject: Evaluate PHP var in stored sql statement?
Groups: php.general 
Request: Send a blank email to php-general+get-133017@lists.php.net to get a copy of this message
Hey all. I need to find out how to get PHP to evaluate a PHP variable stored in our MySql database. Currently the variable is being read as a string; i.e. select * from table where column = $myrow[0] -- instead of evaluating $myrow[0] as a variable. The SQL statement is retrieved in the first call to dbConnect (see code below) dbConnect("SELECT header_id, header, sql_query FROM cat_headers WHERE section_id = $_REQUEST[section_id] order by header"); $set = $result; /* Give initial result set a unique name */ while ($myrow = mysql_fetch_row($set)) { echo(Display the header title here); dbConnect($myrow[2]); /* $myrow[2] is the sql_query gotten from the first dbConnect() call */ $set1 = $result; /* Give next result set a unique name */ while ($myrow = mysql_fetch_row($set1)) { echo(Display category rows here); } } -- Any leads/suggestions much appreciated.......... --Noah

« previous php.general (#133017) next »