2013-04-23 137 views
0

執行此代碼時,它給出了一個我不知道的錯誤消息。我做了goooooogle,但我沒有找到任何解決方案。注意:試圖獲取非對象的屬性在C: xampp htdocs

**注意:試圖讓非對象的屬性在C:\ XAMPP \ htdocs中**

<?php 
    $_REQUEST['PropertyID']; 
    $_REQUEST['PropertyImageID']; 
    $propertyImageID=$_GET['PropertyImageID']; 
    $PropertyID=$_GET['PropertyID']; 
    require_once('db.php'); 
    $propertyquery = "SELECT PropertyImageID, PropertyName, PropertyStatus, PropertyLocation, PropertyRegion FROM properties WHERE PropertyImageID =$propertyImageID"; 
    $propertyquery_run = $connection->query($propertyquery); 
    if ($propertyquery_run-> num_rows > 0) 
    { 
     while ($propertyrow = $propertyquery_run-> fetch_assoc()) 
      { 
     $imagequery = "SELECT PropertyImageID, ImagePath FROM propertyimages WHERE PropertyImageID = $PropertyID"; 
     $imagequery_run = $connection->query($imagequery);  
    ?> 
      <table style="margin-left:348px;"> 
    <tr><td>PropertyName:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo htmlentities($propertyrow['PropertyName']) ?></span></td></tr> 
    <tr><td>PropertyStatus:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo htmlentities($propertyrow['PropertyStatus']) ?></span></td></tr> 
    <tr><td>PropertyLocation:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo htmlentities($propertyrow['PropertyLocation']) ?></span></td></tr> 
    <tr><td>PropertyRegion:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo htmlentities($propertyrow['PropertyRegion']) ?></span></td></tr> 
      </table> 
     <center> 
    <?php 
       if($imagequery_run -> num_rows > 0) 
       { 
        while ($imagerow = $imagequery_run-> fetch_assoc()) 
        { 
        ?> 
         <div style="border:solid 2px #9F0; border-radius:5px; height:222px; width:544px;"> 
         <img src="<?php echo htmlentities($imagerow['ImagePath']) ?>" width="544" height="222" > 
         </div><br />  
        <?php 
        } 
        } 

       } 
      } 
    ?> 
+0

您是否有錯誤的行號? – ibi0tux 2013-04-23 09:08:09

+0

那麼,當你初始化'$連接'?而且,頂部的'$ _REQUEST'行也沒用。 ^^ – Jon 2013-04-23 09:08:59

+0

如果你使用mysqli,那麼你一次只能做1個查詢 – Waygood 2013-04-23 09:09:04

回答

0

,當你使用非對象變量作爲對象,就會出現此通知。 您可能正在使用:$a -> b類似變量$a的語法,它不是一個對象。

確保$propertyquery_run$imagequery_run ...是具有您正在使用的屬性的對象。

編輯:

如果錯誤是在這裏$imagequery_run -> num_rows > 0。這意味着$imagequery_run不是具有num_rows屬性的對象。也許它是NULL。在測試之前檢查它的值。

$imagequery = "SELECT PropertyImageID, ImagePath FROM propertyimages WHERE PropertyImageID = $PropertyID"; 
$imagequery_run = $connection->query($imagequery);  
if(!$imagequery_run) 
{ 
    // do what you want 
} 
+1

簡而言之:您的查詢失敗! – Waygood 2013-04-23 09:12:08

+0

iam接收第一個查詢結果,這是文本信息我沒有收到第二個查詢,這是圖像 – user2279037 2013-04-23 09:13:09

+1

http://stackoverflow.com/questions/112775/possible-to-use-multiple-nested-mysqli-statements – Waygood 2013-04-23 09:14:50

相關問題