Jump to content

Mysql_fretch_array


chriscloyd

Recommended Posts

i get this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.giro/thegtz/aspire-hosting.net/includes/latestthreads.php on line 5

and my code is

[code]<?php
include("threaddb.php");
$latest = mysql_query("SELECT * FROM 'thread' ORDER BY date DESC 'threadid' LIMIT '7'");
echo '<table width="193" border="0" bordercolor="#000000" bgcolor="#FFFFFF">';
while ($row = mysql_fetch_array ($latest)){
echo '<tr>
    <td width="105"><div align="left">'.$row['title'].'</div></td>
    <td width="78"><div align="center"><a href="forums/showthread.php?t'.$row['threadid'].'">View</a></div></td>
  </tr>';
}
echo '</table>';
?>[/code]

can someone help me fast please
Link to comment
Share on other sites

Try:

[code]
<?php
include("threaddb.php");
$latest = mysql_query("SELECT * FROM 'thread' ORDER BY date DESC 'threadid' LIMIT '7'");
while ($row = mysql_fetch_array ($latest)){
$title = $row['title'];
$threadid = $row['threadid'];
?>
<table width="193" border="0" bordercolor="#000000" bgcolor="#FFFFFF">';
<tr>
<td width="105"><div align="left"><?php echo $title; ?></div></td>
<td width="78"><div align="center"><a href="forums/showthread.php?t=<?php echo $threadid; ?>'">View</a></div></td>
</tr>
<?php
}
echo '</table>';
?>
[/code]
Link to comment
Share on other sites

Not sure if it matters, but try:

[code]
<?php
include("threaddb.php");
$latest = mysql_query("SELECT * FROM 'thread' ORDER BY date DESC 'threadid' LIMIT '7'");
while ($row = mysql_fetch_array($latest)){ //took out the space
$title = $row['title'];
$threadid = $row['threadid'];
?>
<table width="193" border="0" bordercolor="#000000" bgcolor="#FFFFFF">';
<tr>
<td width="105"><div align="left"><?php echo $title; ?></div></td>
<td width="78"><div align="center"><a href="forums/showthread.php?t=<?php echo $threadid; ?>'">View</a></div></td>
</tr>
<?php
}
echo '</table>';
?>
[/code]
Link to comment
Share on other sites

It's different than the first one I posted, I commented on the slight difference. I said I wasn't sure if it mattered, but the first one was:

[code]
while ($row = mysql_fetch_array ($latest)){
[/code]

The second one was:

[code]
while ($row = mysql_fetch_array($latest)){ //took out the space
[/code]
Link to comment
Share on other sites

ya the error im getting now is

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 'threadid LIMIT 7' at line 1

and my mysql_query is

mysql_query("SELECT * FROM thread ORDER BY threadid DESC threadid LIMIT 7") or die(mysql_error());
Link to comment
Share on other sites

[code]<?php
include("threaddb.php");
$latest = mysql_query("SELECT * FROM thread ORDER BY threadid DESC LIMIT 7") or die(mysql_error());
echo '<table width="193" border="0" bordercolor="#000000" bgcolor="#FFFFFF">';
while ($row = mysql_fetch_array($latest)){

$title = $row['title'];
$threadid = $row['threadid'];
echo '<tr>
<td width="105"><div align="left">'.$title.'</div></td>
<td width="78"><div align="center"><a href="forums/showthread.php?t'.$threadid.'">View</a></div></td>
</tr>';
}
echo '</table>';
?>[/code]
Link to comment
Share on other sites

i just dont know why it will work when u go to the actuall page like
http://www.aspire-hosting.net/includes/latestthreads.php
but not when u go to
http://www.aspire-hosting.net

I have tried where i just post the code on the index.php file but it still wont show!
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.