<?php
$conn=mysql_connect("localhost","admin","admin");
mysql_select_db("lucy1015",$conn);
mysql_query("SET NAMES gbk");
error_reporting(0);
function shili ( $x ){
$sql=mysql_query("select * from phpcms_yuyan where english='$x'",$conn);
$info=mysql_fetch_array($sql);
echo $info[chinese];
echo $info[english]; }shili ( jobs ) ; ?>
数据库结构如下
id english chinese 1 jobs 工作
2 girls 女孩
3 boys 男孩
---------------------
$conn=mysql_connect("localhost","admin","admin");
mysql_select_db("lucy1015",$conn);
mysql_query("SET NAMES gbk");
error_reporting(0);
function shili ( $x ){
$sql=mysql_query("select * from phpcms_yuyan where english='$x'",$conn);
$info=mysql_fetch_array($sql);
echo $info[chinese];
echo $info[english]; }shili ( jobs ) ; ?>
数据库结构如下
id english chinese 1 jobs 工作
2 girls 女孩
3 boys 男孩
---------------------
$sql=mysql_query("select * from phpcms_yuyan where english='$x'");
$info=mysql_fetch_array($sql);
echo $info[chinese];
echo $info[english]; }shili ( 'jobs' ) ;
你把 error_reporting(0); 去掉!!!
Notice: Use of undefined constant chinese - assumed 'chinese' in D:\PC_webserver\phproot\yuyan2.php on line 14
招聘求职
Notice: Use of undefined constant english - assumed 'english' in D:\PC_webserver\phproot\yuyan2.php on line 15
jobs
Notice: Use of undefined constant japanese - assumed 'japanese' in D:\PC_webserver\phproot\yuyan2.php on line 16
募集
你把$info[chinese]改成$info['chinese']就可以了。
error_reporting(E_ALL & ~E_NOTICE);正式运行时
error_reporting(0);