Jump to content

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in


ardhix

Recommended Posts

i have found warning message =  Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given inC:\xampp\htdocs\articles\artikel.php on line 7

 

 

  

 

<?php
   include 'koneksi.php';
$articleid = $_GET['articleid'];
$sql_query = 'SELECT ta.*, tca.category_article FROM article_news AS ta INNER JOIN tcategory_article AS tca ON ta.category_article_id = tca.category_article_id WHERE article_id = '.$articleid;
$query = mysql_query($sql_query);
$row = mysql_fetch_array($query); //--> this is line #7 


$msg = $_GET['msg'];
if(!empty($msg)){
if($msg = 100){
echo '<h5 style="text-align:center; color:#f00; font-weight: normal">.</h5>';
}
} 
?>


  <!--articles-->
  <a name="TemplateInfo"></a>
  <input type="hidden" name="prodid" value="<?php echo $row['article_id'];?>" size="1"/>
<h1><?php echo $row['judul'];?></h1>
<p><a href=""><img src="images/upload/<?php echo $row['photo'];?>" width="100" height="120" class="float-left"></a>
                <p><?php echo $row['artikel'];?></a>.
                </p>
<!--end of articles-->
                
<p><?php echo $row['category_article'];?></p>
<p class="post-footer"> 
<a href="index.html" class="readmore">Read more</a>
<a href="index.html" class="comments">Comments (7)</a>
<span class="date"><?php echo $row['tanggal'];?></span> 
</p>
 

 

please help me :)
 
i'm sorry newbie here..
Edited by ardhix
Link to comment
Share on other sites

i've change 

 

Please wrap your code in code tags. You can do this using the <> button in the editor. As well, always point out which line is referred to in the error (in this case, which line is #53?).

 

i've change with editor, is that correct?

Link to comment
Share on other sites

Your query is failing for some reason. Change this line:

 

 

$query = mysql_query($sql_query);

 

To this:

 

$query = mysql_query($sql_query) or die(mysql_error());

 

Run the script again, and let us know the output.

 

 

now it shows message :

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Link to comment
Share on other sites

What does this show:

 

 

die($sql_query = 'SELECT ta.*, tca.category_article FROM article_news AS ta INNER JOIN tcategory_article AS tca ON ta.category_article_id = tca.category_article_id WHERE article_id = '.$articleid);

 

I'm thinking $articleid is empty.

Edited by haku
Link to comment
Share on other sites

What does this show:

 

 

die($sql_query = 'SELECT ta.*, tca.category_article FROM article_news AS ta INNER JOIN tcategory_article AS tca ON ta.category_article_id = tca.category_article_id WHERE article_id = '.$articleid);

 

I'm thinking $articleid is empty.

 

Solved now.. by removing $articleid, the data shows up, thank you very much

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.