我想展示我所有的襯衫,但我總是得到同樣的錯誤如何顯示SQL語句的所有結果?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/36/d362778419/htdocs/home/specials.php on line 34
這裏是我目前到位
<?php
require "connect2.php";
$sql = mysql_query("SELECT * FROM shirts WHERE all='1'");
$runrows = mysql_fetch_array($sql);
$title = $runrows['title'];
$picture = $runrows['picture'];
$newp = $runrows['newp'];
$date = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['date']));
$oldp=$runrows['oldp'];
$viewl=$runrows['viewl'];
$shirtl = $runrows['shirtl'];
echo "";
?>
<div class="specialsListBoxContents centeredContent back" style="width:25%;"><div class="product-col" > <div class="img">
<a href="detail.php?id=<?php echo $id; ?>"><img src="<?php echo $picture; ?>" alt="<?php echo $title; ?>" title=" <?php echo $title; ?> " width="190"
height="160" /></a> </div> <div class="prod-info"> <div class="wrapper">
<div class="price"> <strong><span class="normalprice"><?php echo $oldp; ?
></span><br /><span class="productSpecialPrice"><?php echo $newp; ?></span></strong> </div>
<div class="button"><a href="detail.php?id=<?php echo $id; ?>"><img src="images/button_add_to_cart.gif" alt="Add to Cart" title=" Add to Cart " width="54"
height="49" /></a></div> </div> </div> </div></div>
<?php
?>
首先切換到'PDO'。 – 2011-09-15 17:07:54
你確定連接你的MySQL數據庫嗎? mysql_query()可以帶一個可選的參數來指定數據庫連接,否則它使用最後一次引用的連接。你能否驗證「connect2.php」內的連接是否正在工作? –
你是什麼意思? – joe