新人請問mysql+php 頁面之間從資料庫調出圖片不能顯示有關問題

來源:互聯網
上載者:User
新人請教mysql+php 頁面之間從資料庫調出圖片不能顯示問題
mysql+php 頁面之間顯示圖片問題,怎樣才能讓商品名和對應的圖片正常顯示呢。

1,index.php
.......前面省略

" width="120" height="135" border="3" >


商品名:

<{$myrow[data].tb_commodity_id}>


<{$myrow[data].tb_commodity_name}>




2,head_picture.php
$query="select * from tb_commodity where tb_commodity_id=".$recid;
$result=mysql_query($query);
if(!$result) die("error: mysql query");
$num=mysql_num_rows($result);
if($num<1) die("error: no this recorder");
$data = mysql_result($result,0,"tb_commodity_picture");
mysql_close($conn);
echo $data;
?>

3,資料庫表中包含:tb_commodity_id,tb_commodity_name,tb_commodity_picture 欄位。

在index頁面,商品名能夠正常顯示資料庫裡面的5條資料,包括tb_commodity_id 和tb_commodity_name都能正常顯示,只有圖片不能正常顯示,如果將head_picture.php 裡面$query="select * from tb_commodity where tb_commodity_id=".$recid; 直接改成:$query="select * from tb_commodity where tb_commodity_id=1";(或者2,3,4,5,即對應的tb_commodity_id在資料庫中的值)能夠正常顯示圖片,資料庫裡面目前有5條資料;
改成:$query="select * from tb_commodity where tb_commodity_id=".$myrow[data].tb_commodity_id;顯示tb_commodity_id=5的圖片;
點擊index頁面不能顯示出來的圖片,在新標籤頁中開啟圖片,地址欄中網址是:本機名/head_picture.php?recid=5(點recid對應的圖片,會顯示對應的recid),頁面中顯示:error: mysql query

分享到:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.