Search the Community
Showing results for tags 'mysql_fetch_array()'.
-
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..
-
Hello I tried to move the bold section of the below code into a function getWeights() located in a m_weight.php file (I want to implement MVC pattern) <?php $get_weights_q = mysql_query (" SELECT * FROM users_weight WHERE weight_uid = '$user_id' ORDER BY weight_date DESC ", toctoc() ) or die(mysql_error() ); while ($weight = mysql_fetch_array($get_weights_q)) { ?> <li> <?php echo date( " d M-y H:i (l) " , $weight['weight_date']). ' : ' . $weight['weight'] . ' <a href="'.$_SERVER['SCRIPT_NAME'].'?del=' . $weight['weight_id'] . '">Changer</a> ' ; } ?> </li> </ul> ---------------- Here is the function: function getWeights($user_id) { $get_weights_q = mysql_query (" SELECT * FROM users_weight WHERE weight_uid = '$user_id' ORDER BY weight_date DESC ", toctoc() ) or die(mysql_error()); } The result is : Notice: Undefined variable: get_weights_q in H:\home\user\documents\DEV-H\EasyPHP-5.3.8.1\www\Food-Tribe\v_weight.php on line 44 Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in H:\home\user\documents\DEV-H\EasyPHP-5.3.8.1\www\Food-Tribe\v_weight.php on line 44 If I let the code just above the While, in procedural mode it works fine... Any idea?