Jump to content

mysql help needed //SOLVED


marcus

Recommended Posts

I am making a news sytem, and on the index it would echo the news. Now, I have two rows in the news table right now, but it's only showing one of them and then i get an error:

[code]
Warning: mysql_fetch_array(): 7 is not a valid MySQL result resource in /home/neoblob/public_html/cms/index.php on line 20
[/code]

[code]
<? include('header.php'); ?>
<?php
$page = $_GET[page];
$fetch = "SELECT * FROM news ORDER BY `id` DESC";
$fet1 = mysql_query($fetch) or die(mysql_error());
$num = mysql_num_rows($fet1);


if(!$page){
$page = 1;
};
if($news == 0){
echo "news not enabled";
}else {

if($num == 0){
echo "No news";
}else {

while ($fet2 = mysql_fetch_array($fet1, MYSQL_BOTH)){
if(!$camount){
$camount = 0;
};
echo "
<table border=0 cellspacing=2 cellpadding=2>
<tr><td colspan=2 align=right>
<h3>$fet2[title]</h3>
<tr><td colspan=2 align=left>
Posted on: $fet2[date] at $fet2[time] by $fet2[poster]
<tr><td colspan=2 align=left>
$fet2[body]
<tr><td align=left>
Category: $fet2[category]<td align=right>";
if($fet2[comments] == 1){
echo "<a href=comments.php?id=$fet2[id]>$fet2[camount] Comments</a>
</table><br><br>";
};
mysql_free_result($fet1);
};
};
};
?>
<? require('footer.php'); ?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/28384-mysql-help-needed-solved/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.