<?php
$connid=@mysql_connect("localhost","root","Admin","test");
$sql="select pic from $table where id=$id";
$result=mysql_db_query("photo",$sql);
$image=mysql_result($result,0,"pic");
echo $image;
?>
和
<?php
if($offset == "")
{$offset = 0;}
$Connid = @mysql_connect("localhost","root","Admin","test");
$sql = "select id,name from photo order by id desc limit $offset,6";
$result = mysql_db_query("photo",$sql);
$num = mysql_num_rows($result);
if($num != 0)
{
$i = 0;
while($r = mysql_fetch_array($result))
{
$id = $r["id"];
$ftitle = $r["name"];
if($i == 0 or $i == 3)
{
echo "<tr>";
}
echo "<tr width=165 bgcolor=#c2eoa5 class=NT9 align=center height=126>";
echo "<a href=photo_info.php?id=$fid>";
echo "show.php?table=photo&id=$fid";
echo "height=60></a>";
echo "<a href=photo_info.php?id=$fid>";
echo "<p>$ftitle</p></a></td>";
if($i == 2 or $i == 5)
{echo "<tr>";}$i++;
}
}
?>
$connid=@mysql_connect("localhost","root","Admin","test");
$sql="select pic from $table where id=$id";
$result=mysql_db_query("photo",$sql);
$image=mysql_result($result,0,"pic");
echo $image;
?>
和
<?php
if($offset == "")
{$offset = 0;}
$Connid = @mysql_connect("localhost","root","Admin","test");
$sql = "select id,name from photo order by id desc limit $offset,6";
$result = mysql_db_query("photo",$sql);
$num = mysql_num_rows($result);
if($num != 0)
{
$i = 0;
while($r = mysql_fetch_array($result))
{
$id = $r["id"];
$ftitle = $r["name"];
if($i == 0 or $i == 3)
{
echo "<tr>";
}
echo "<tr width=165 bgcolor=#c2eoa5 class=NT9 align=center height=126>";
echo "<a href=photo_info.php?id=$fid>";
echo "show.php?table=photo&id=$fid";
echo "height=60></a>";
echo "<a href=photo_info.php?id=$fid>";
echo "<p>$ftitle</p></a></td>";
if($i == 2 or $i == 5)
{echo "<tr>";}$i++;
}
}
?>
和
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in F:\資料夾\Html\相片集\show.php on line 5
还有就是执行的sql出错的可能性比较大。
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in F:\
和
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in F:\資料夾\Html\相片集\show.php on line 5
mysql_select_db("photo");
$sql = "select id,name from photo order by id desc limit $offset,6";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
这样看看。