Page 2 of 2

Posted: Tue Dec 16, 2003 9:29 am
by JayBird
this line is PHP

Code: Select all

$query = "SELECT password from ".$tablename." WHERE username = '".$_SESSION['username']."'";
All you are doing is building a query as a string in PHP.

When you echo that query, it is still PHP.

So basically, PHP is not doing its job by parsing the variables to build the query before you pass it to the mysql_db_query() function to query the database.

Mark

Posted: Tue Dec 16, 2003 9:32 am
by malcolmboston
yeah, i understand that its PHP, its in the ?php tags obviously, im not that much of a newb

what im saying is that it cannot b a installation problem when it is perfectly capable of creating and retrieving server vars when i ask it to but not able to read the var inside a SQL query

does anyone have any idea a possible cause/fix to this problem?

Posted: Tue Dec 16, 2003 9:34 am
by JayBird
okay, run this this code in a new php file and post the results

Code: Select all

<?

//Run this script AS IS and post the results on the forum

$test_variable = "Yes I printed";

echo $test_variable;
echo "<br>";
echo $test_variable." with this concat on the end";
echo "<br>";
echo "Concat begining ".$test_variable;
echo "<br>";
echo "Concat begining ".$test_variable." concat end";

?>
Mark

Posted: Tue Dec 16, 2003 9:41 am
by malcolmboston
i cant do it now im not @ home :(

Posted: Tue Dec 16, 2003 9:45 am
by JayBird
do it when you can and post the results then :)

Mark

Posted: Tue Dec 16, 2003 9:46 am
by malcolmboston
thanks bech

its much appreciated

:wink: