Cooper94 Posted April 11, 2009 Share Posted April 11, 2009 <?php include 'inc/header.php'; include 'data.php'; ?> <?php include 'inc/side.php'; ?> <div id="main_content"> <div id="new_item"> <?php $result = mysql_query("SELECT * FROM news WHERE id = '{$_GET[id]}'"); $num = mysql_num_rows($result); $row = mysql_fetch_assoc($result); ?> <div id="new_item_header"> <h1><?php echo $row['subject']; ?>!</h1> </div> <div id="new_item_text"> <p> <?php echo $row['body']; ?> </p> </div> <?php include 'inc/footer.php'; ?> I get this error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/cmxvacom/public_html/site/fullevents.php on line 11. Any ideas on how to fix this any help would be great, thank you guys! Link to comment https://forums.phpfreaks.com/topic/153570-num_rows/ Share on other sites More sharing options...
dadamssg Posted April 11, 2009 Share Posted April 11, 2009 try using mysqli for all your queries...see what happens Link to comment https://forums.phpfreaks.com/topic/153570-num_rows/#findComment-806975 Share on other sites More sharing options...
schilly Posted April 11, 2009 Share Posted April 11, 2009 did you connect to the database? Link to comment https://forums.phpfreaks.com/topic/153570-num_rows/#findComment-806981 Share on other sites More sharing options...
Cooper94 Posted April 11, 2009 Author Share Posted April 11, 2009 Were it says include 'inc/side.php' this is the side code: <div id="left_sidebar"><br> <div id="categories"> <div id="categories_header"> <h2>Newest Airlines</h2> </div> <ul> <?php include 'data.php'; $result = mysql_query("SELECT * FROM airlines ORDER BY date DESC LIMIT 5"); echo "<table width=100%> <tr> <th>Name</th> <th>Date</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><a href=$row[url]>$row[name]</a></td>"; echo "<td>$row[date]</td>"; echo "</tr>"; } echo "</table>"; ?> </ul> <br> <div id="categories_header"> <h2>Partners</h2> </div> <ul> <a href="http://www.czwgfir.org/"><img src="images/ywg.jpg" /></a> </ul> <br> <div id="categories_header"> <h2>Latest Forum Topics</h2> </div> <ul> <?php include 'fdata.php'; $results = mysql_query("SELECT * FROM phpbb_topics WHERE forum_id = '2' ORDER BY topic_time DESC LIMIT 3"); echo "<table width=100%> <tr> <th>Subject</th> <th>Posted By</th> </tr>"; while($rows = mysql_fetch_array($results)) { echo "<tr>"; echo "<td><a href=http://cmxva.com/site/phpBB3/viewtopic.php?f=$rows[topic_id]&t=$rows[topic_id]>$rows[topic_title]</a></td>"; echo "<td>$rows[topic_first_poster_name]</td>"; echo "</tr>"; } echo "</table>"; ?> </ul> <div class="clearthis"> </div> </div> </div> I hope that helps some thank you again for your help! Link to comment https://forums.phpfreaks.com/topic/153570-num_rows/#findComment-806983 Share on other sites More sharing options...
schilly Posted April 11, 2009 Share Posted April 11, 2009 did you connect to the database? mysql_connect? Link to comment https://forums.phpfreaks.com/topic/153570-num_rows/#findComment-806985 Share on other sites More sharing options...
Cooper94 Posted April 11, 2009 Author Share Posted April 11, 2009 yes Link to comment https://forums.phpfreaks.com/topic/153570-num_rows/#findComment-806997 Share on other sites More sharing options...
schilly Posted April 11, 2009 Share Posted April 11, 2009 <?php $result = mysql_query("SELECT * FROM news WHERE id = '{$_GET[id]}'"); $num = mysql_num_rows($result); $row = mysql_fetch_assoc($result); ?> I'd echo your query to make sure the id is getting inserted. Link to comment https://forums.phpfreaks.com/topic/153570-num_rows/#findComment-806999 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.