如何将字符串变量放在mysql_resutl字段中?
问题描述:
I want to run this code :
if ($_GET['CHOOSE'] == 1)
{
$field = " 'col1' ";
}
else
{
$field = " 'col2 ' ";
}
echo mysql_result($result,0,$field);
unfortunately I got false ??
我想运行此代码: p>
if($ _GET ['CHOOSE'] == 1)
{
$ field =“'col1'”;
}
else
{
$ field =“'col2'”;
}
\ n echo mysql_result($ result,0,$ field);
code> pre>
不幸的是我弄错了? p>
div>
答
Try this
if ($_GET['CHOOSE'] == 1)
{
$field = "col1";
}
else
{
$field = "col2";
}
echo mysql_result($result,0,$field);