gpt4 book ai didi

PHP 警告 : mysql_num_rows(): supplied argument is not a valid MySQL result resource in

转载 作者:行者123 更新时间:2023-11-29 04:54:14 25 4
gpt4 key购买 nike

<分区>

我正在为库存数据库创建 CRUD。加载 index.php 后,我的 error_log 返回以下内容:

PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home1/theantj4/public_html/crud/index.php on line 32

我真的不知道是什么导致了错误,但这是我正在处理的问题,也许有人可以发现问题...

连接.php

<?php
$conn = mysql_connect('localhost','usrname','pwd') or
die(mysql_error('unable to connect to given database'));

mysql_select_db('theantj4_antique',$conn) or die(mysql_error('unable to select
database'));
?>

索引.php

<!DOCTYPE HMTL>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Inventory Management Tool</title>
</head>
<body>
<?php require_once('connection.php'); ?>
<?php
$query = mysql_query("SELECT * FROM inventory");
$result = mysql_query($query);
?>
<div id="addinventory"><a href="add.php">Add Contact</a></div>
<table width="540" border="0" cellpadding="3">
<tr style="color:#FF">
<td width="150" bgcolor="#cccccc">itemNumber</td>
<td width="150" bgcolor="#cccccc">itemTitle</td>
<td width="150" bgcolor="#cccccc">itemDate</td>
<td width="150" bgcolor="#cccccc">itemPrice</td>
<td width="150" bgcolor="#cccccc">itemAuthor</td>
<td width="150" bgcolor="#cccccc">itemMedium</td>
<td width="150" bgcolor="#cccccc">itemCondition</td>
<td width="150" bgcolor="#cccccc">itemInches</td>
<td width="150" bgcolor="#cccccc">itemMetric</td>
<td width="150" bgcolor="#cccccc">smallImageName</td>
<td width="150" bgcolor="#cccccc">bigImageName</td>
<td width="150" bgcolor="#cccccc">itemCategory1</td>
<td width="150" bgcolor="#cccccc">itemCategory2</td>
</tr>
<?php
$i=0;
if(mysql_num_rows($result) > 0) { /*Line 32*/
while($row=mysql_fetch_object($result)) { $i++ ; ?>

<tr class="box" <?php if($i%2==0) { ?> bgcolor="#C5E8E1" <?php } else { ?>bgcolor="#E2EFD0" <?php } ?>>
<td><?php echo $i; ?></td>
<td><span id="itemNumber-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemNumber;?></span></td>
<td><span id="itemTitle-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemTitle;?></span></td>
<td><span id="itemDate<-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemDate;?></span></td>
<td><span id="itemPrice-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemPrice;?></span></td>
<td><span id="itemAuthor-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemAuthor;?></span></td>
<td><span id="itemMedium-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemMedium;?></span></td>
<td><span id="itemCondition-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemCondition;?></span></td>
<td><span id="itemInches-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemInches;?></span></td>
<td><span id="itemMetric-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemMetric;?></span></td>
<td><span id="smallImageName-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->smallImageName;?></span></td>
<td><span id="bigImageName-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->bigImageName;?></span></td>
<td><span id="itemCategory1-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemCategory1;?></span></td>
<td><span id="itemCategory2-<?php echo $row->itemNumber; ?>" class="editText"><?php echo $row->itemCategory2;?></span></td>
<td><a href="edit.php?id=<?php echo $row->itemNumber; ?>">Edit</a> / <a class="delete" id="<?php echo $row->itemNumber; ?>" onclick="return confirm('are you sure you want to delete');" href="#" >Delete</a></td>
</tr>
<?php } ?>
<?php } else {
echo 'There is no Records';
exit;
}?>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com