Reply to Name of a variable in MySQL field

Your name:

Reply:


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;
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация