Posted by Heike Behrens on 11/19/52 11:47
Hello all!
The following example
$welt="World";
echo "<br>Hello $welt";
gives me "Hello World" as result. No problem so far. But why doesn't a
string from a MySQL table behave the same? Fieldname contains the string
"$jahr". And the output is "$jahr", and not 2006.
Maybe someone has a hint? Putting $jahr in brackets or using other
string functions on it had no effect so far. Thanks for any help!
Heike
$db = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db ($db_name) or die ("Cannot connect to database");
$erg=mysql_query("select fieldname from tablename where id=20") or
die("Error");
$jahr=2006;
if ($all=mysql_fetch_array($erg)) {
extract($all);
echo $fieldname;
}
Navigation:
[Reply to this message]
|