<?php
include ("homeconfig.php");
mysql_query("SET NAMES UTF8"); //解决中文乱码问题 $sql = "SELECT information FROM information ORDER BY infoid DESC";
$result = mysql_db_query($sql);
while ($row=mysql_fetch_array($result)){
$words = $row['information'];
}echo $words;
//include("contactpage.html");
?>Warning: Wrong parameter count for mysql_db_query() in wordshow.php on line 6Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /wordshow.php on line 7
这个地方配置 应该没问题 因为前面 添加数据的时候用来 没问题 但是 这里输出的报错啊
include ("homeconfig.php");
mysql_query("SET NAMES UTF8"); //解决中文乱码问题 $sql = "SELECT information FROM information ORDER BY infoid DESC";
$result = mysql_db_query($sql);
while ($row=mysql_fetch_array($result)){
$words = $row['information'];
}echo $words;
//include("contactpage.html");
?>Warning: Wrong parameter count for mysql_db_query() in wordshow.php on line 6Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /wordshow.php on line 7
这个地方配置 应该没问题 因为前面 添加数据的时候用来 没问题 但是 这里输出的报错啊
while ($row=mysql_fetch_array($result)){
$words = $row['information'];
}print_r $words;
这里应该怎么样来输出这个数组
楼主究竟想干什么呢???要不就不用循环,要不循环有什么用呢?循环是动态的显示。把代码改为:<?php
include ("homeconfig.php");
mysql_query("SET NAMES UTF8"); //解决中文乱码问题 $sql = "SELECT information FROM information ORDER BY infoid DESC";
$result = mysql_query($sql); //改的地方
$row=mysql_fetch_array($result);//改的地方print_r($rows);
//include("contactpage.html");
?> 或者是:<?php
include ("homeconfig.php");
mysql_query("SET NAMES UTF8"); //解决中文乱码问题 $sql = "SELECT information FROM information ORDER BY infoid DESC";
$result = mysql_query($sql); //改的地方
while ($row=mysql_fetch_array($result)){
echo $row['information']."<br>";//输出,改的地方
}
//include("contactpage.html");
?>
include ("homeconfig.php");
mysql_query("SET NAMES UTF8");
$result=mysql_query("select information from information order by infoid desc");
for($row=0;$row<mysql_num_rows($result);$row++)
for($col=0;$col<mysql_num_fields($result);$col++)
echo mysql_result($result,$row,$col);
?>
mysql_query("SET NAMES UTF8"); //解决中文乱码问题 $sql = "SELECT information FROM information ORDER BY infoid DESC";
$result = mysql_db_query($sql);
while ($row=mysql_fetch_array($result)){
$words = $row['information'];
echo $words;
}
注意在大括号内,,
如果只是想得到所有的INFormationinclude ("homeconfig.php");
mysql_query("SET NAMES UTF8"); //解决中文乱码问题 $sql = "SELECT information FROM information ORDER BY infoid DESC";
$result = mysql_db_query($sql);
while ($row=mysql_fetch_array($result)){
$words[] = $row['information']; } var_dump($words);