$code in Mysql
Posted: Mon Sep 20, 2010 1:17 pm
Hello, I turned out a doubt, want to get php variables in mysql and then call them. this example will say more or less what I mean
In MySql
tableVars
id value
1 $var1
2 $var2
in PHP
i want this:
results = hello world
-------------------------------------------------
but my problems is when i call the rows and the results are $var1 $var2
help me please...
In MySql
tableVars
id value
1 $var1
2 $var2
in PHP
Code: Select all
<?php
mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME);
$var1 = 'hello';
$var2 = 'world';
$sql = 'SELECT * FROM `tableVars`';
$res = mysql_query($sql);
echo 'results=';
while($row = mysql_fetch_assoc($res)){
echo $row['value'];
}
?>
results = hello world
-------------------------------------------------
but my problems is when i call the rows and the results are $var1 $var2
help me please...