Gå til innhold

Nyhetsarkiv; Hjelp til feilsøking (løst)


Anbefalte innlegg

Hei, jeg skal lage et nyhetsarkiv til denne siden, basert på nyhets tigan på høyre side. Ja har laget en fil som jeg skal include i nyhetsarkivet. Den *.php fila ser sånn ut:

<?php
echo "    
   <h1>NyhetsArkiv</h1>       
";

$q = "SELECT * FROM userdef_2 WHERE endret='1' ORDER BY id 0";
$result = mysql_query($q); 
$rows = mysql_num_rows($result);
while($rows--) 
{
$news = mysql_fetch_object($result);
?>
        
 <font class=smallnews><b><?=$news->field_03?></b>
    <br>
 <font align=right><?=$news->field_02?><br>
    <font align=left><?=$news->field_04?><br>
    <a href="visnyhet.php?id=<?=$news->id?>">les mer..</A></font>
    <br>
    <img src="dot.gif" height=5 alt="" border=0>

 

Hva er feil?? er ennå litt nybegyner på php.

 

Løst: skulle ikke være 0 bak ORDER BY id,, hehe, er blind jeg

Endret av Lasso5000
Lenke til kommentar
Videoannonse
Annonse

Her er scriptet til hovedsiden:

<?

$SITEDB="rgolf";
include("conf/setup.php");

mysql_connect("$SQLSERVER","$SQLUSER","$SQLPWD");

$query = "select * from onepagers where type='8'";
$result = mysql_db_query("$SQLDB", $query);
if ($result) {
 while ($r = mysql_fetch_array($result)) {
   $title = $r["title"];
   $type = $r["type"];
   $artid = $r["id"];
   $text = nl2br($r["text"]);
   $addyid = $r["addyid"];
   $date = $r["date"];
   $query2 = "select fornavn,etternavn,email from addyer where id='$addyid'";
   $result2 = mysql_db_query("$SQLDB", $query2);
   if ($result2) {
     while ($r2 = mysql_fetch_array($result2)) {
       $fornavn = $r2["fornavn"];
       $etternavn = $r2["etternavn"];
       $email = $r2["email"];
     }
   } 
   $query3 = "select menu from menu where menuid='$type'";
   $result3 = mysql_db_query("$SQLDB", $query3);
   if ($result3) {
     while ($r3 = mysql_fetch_array($result3)) {
       $title = $r3["menu"];
     }
   }
 }
}
mysql_close();

$connection = @mysql_pconnect("ip","sqlnavn","passord") or die("fault");
$base_connection = mysql_select_db("db_randaberg-golf_no");

echo "

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>
<META http-equiv=Content-Language content=no-bok>
<META content='NorBalt.no' name=Keywords>
<META http-equiv=Content-Type content='text/html; charset=ws-1252'>
<LINK href='styles.css' type=text/css rel=stylesheet>
</HEAD>
<BODY leftMargin=0 topMargin=0 rightMargin=0 marginheight='0' marginwidth='0'>

<TABLE width='100%' height='100%' cellSpacing=0 cellPadding=0 border=0>
<tr>
<td width=30% bgColor=#DED7BD></td>
<td width=1 bgColor=#666666><img src='d.gif'></td>
<td valign=top>
<TABLE width=800 cellSpacing=0 cellPadding=0 border=0 bgColor=white>
 <TBODY>
 <TR>
   <TD valign=top>
<TABLE height=109 cellSpacing=0 cellPadding=0 width='100%' border=0>
<TBODY>
 <TR>
  <TD valign=top><IMG SRC='images/top.jpg' border=0></td>
 </TR>
</TBODY>
</TABLE>   
</td>
</tr>

<TR>
<TD valign=top>
<TABLE height=26 cellSpacing=0 cellPadding=0 width='100%' background=tiledadobebg.gif border=0>
 <TBODY>
 <TR>
   <TD valign=top>
     <TABLE cellSpacing=0 cellPadding=0 border=0>
       <TBODY>
       <TR>
<TD><A class=toplink href='index.php' ><B>Hjem</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>
<TD><A class=toplink href='turneringer.php' ><B>Turneringer</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>

<TD><A class=toplink href='aktiviteter.php' ><B>Kurs</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>
<TD><A class=toplink href='banen.php' ><B>Banen</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>
<TD><A class=toplink href='junior.php' ><B>Junior</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>
<TD><A class=toplink href='medlemskap.php' ><B>Medlemskap</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>
<TD><A class=toplink href='om.php' ><B>Om klubben</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>
<TD><A class=toplink href='kontakt.php' ><B>Kontakt oss</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>
<TD><A class=toplink href='filarkiv.php' ><B>Filarkiv</B></A></TD>
<TD><IMG height=26 src='spacer.gif' width=2></TD>
         </TR></TBODY></TABLE>          
         </TD>
</TR>
</TBODY>
</TABLE>
</td>
</TR>

<TR>
<TD valign=top>

<TABLE cellSpacing=0 cellPadding=0 height='100%'  width='100%' border=0>
 <TBODY>
 <TR>
   <TD width=600 valign=top>
    <table width='100%' cellpadding=10 cellspacing=0 >
    <TBODY>
    <TR>
    <TD width=600 valign=top> 

$text


   </TD>
     </tr>
     </table>

   </TD>
<td width=1 bgColor=#ffffff><img src='d.gif'></td>
";
include("nyheter_inc.php");
include("bottom.php")
?>

Her er coden til nyheter_inc.php (includa helt nere i forje script):

<?php
echo "    
   <h1>NyhetsArkiv</h1>       
";

$q = "SELECT * FROM userdef_2 WHERE endret='1' ORDER BY id 0";
$result = mysql_query($q); 
$rows = mysql_num_rows($result);
while($rows--) 
{
$news = mysql_fetch_object($result);
?>
        
 <font class=smallnews><b><?=$news->field_03?></b>
    <br>
 <font align=right><?=$news->field_02?><br>
    <font align=left><?=$news->field_04?><br>
    <a href="visnyhet.php?id=<?=$news->id?>">les mer..</A></font>
    <br>
    <img src="dot.gif" height=5 alt="" border=0>

<?php	
}

og her er bottom.php,, også includa i fila øverst:

<?php
echo "    
   <TD width=200 height='100%' bgcolor='#e6e6e6' valign=top>

    <table width='100%' cellpadding=10 cellspacing=0 >
    <tr>
    <td align='left' valign='top'>
    <h2>Aktivitetskalender</h2>    

     <table width='100%' cellpadding=0 cellspacing=0 border=0>
     <tr>
     <td></td><td align=left valign=top class=news><center><script language='JavaScript' src='cal.php'></script></center></td>
     </tr>
     </table>
    </td>
    </tr>
    </table>



    
    
    <table width='100%'  cellpadding=10 cellspacing=0 bgcolor='#e6e6e6'>
    <tr>
    <td align='left' valign='top'>
<!--     <h2>Siste nytt</h2> -->



    <table width='100%' cellpadding=2 cellspacing=0>
    
";

$q = "SELECT * FROM userdef_2 WHERE endret='1' ORDER BY id LIMIT 0,3";
$result = mysql_query($q); 
$rows = mysql_num_rows($result);
while($rows--) 
{
$news = mysql_fetch_object($result);
?>
         <tr>
 <td valign=top><font class=smallnews><b><?=$news->field_03?></b>
    <br>
 <font align=right><?=$news->field_02?><br>
    <font align=left><?=$news->field_04?><br>
    <a href="visnyhet.php?id=<?=$news->id?>">les mer..</A></font>
    </tr>
    <tr><td><img src="dot.gif" height=5 alt="" border=0></td></tr>
<?php
}
echo "
    </table>

    <table width='100%' height='100%' cellpadding=2 cellspacing=0>
";
$q = "SELECT * FROM userdef_4 WHERE endret='1' ORDER BY id LIMIT 0,1";
$result = mysql_query($q);    
$rows = mysql_num_rows($result);    
while($rows--) 
{
$news = mysql_fetch_object($result);
?>
    <tr>
    <td valign=top><font class=smallnews><b>Banenytt: </b>
    <font align=justify><?=$news->field_04?><br>
    <a href='visbanenyhet.php?id=<?=$news->id?>'>les mer..</A></font>
    </tr>
    <tr><td><img src='dot.gif' height=5 alt='' border=0></td></tr>
<?php
}
echo "   
    </table>



    </td>
    </table>

   </TD>
</TR>
</TBODY>
</TABLE>

</td>
</TR>
<TR>
<TD valign=bottom>
<!--<HR> -->
</td>
</TR>
</TBODY>
</TABLE>   
</td>
<td width=1 bgColor=#666666><img src='d.gif'></td>
<td width=30% bgColor=#DED7BD></td>
</tr>

</table>


</BODY>
</HTML>
";
?>

Her er sia "http//www.randaberg-golf.no"

 

edit: her er feilmeldinga som kommer opp "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/webs/www.randaberg-golf.no/nyheter_inc.php on line 8"

Endret av Lasso5000
Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...