PDA

View Full Version : PHP/MySQL help



DanWilliamson
28-01-2006, 03:32 PM
Hey,

I'm in need of some help with MySQL & PHP i've run into a problem with my tutorials CMS and i've got one error which is good lol i've followed a tutorial and am yet to style it so ignore the tables etc.

Heres the tutorials code:


<?php

include ("dbconnect.php");

if (isset($ID))
{
$tuts="SELECT * from yourtable where ID='$ID'";
$tuts2=mysql_query($tuts);
while ($tuts3=mysql_fetch_array($tuts2))

{

echo "

<table width=100% border=0 cellspacing=3 cellpadding=0>
<tr>
<td>
<font color=#82A1FF size=1 face=Verdana, Arial, Helvetica, sans-serif><b>$tuts3[title]</b><br>
<font color=#000000>By <b>$tuts3[user]</b><br>
<i>$tuts3[description]</i><br>
<br>
$tuts3[message]<br>
<br>
</td>
</tr>
</table>

"; }
}


else if(!isset($id))
{
$tut="SELECT * from yourtable";
$tut2=mysql_query($tut);
while($tut3=mysql_fetch_array($tut2))

{

echo "

<font color=#000000 size=1 face=Verdana, Arial, Helvetica, sans-serif>
<table width=250 border=0 cellspacing=3 cellpadding=0>
<tr>
<td width=42 height=42>
<div align=center><a href='tutorials.php?ID=$tut3[ID]'><img src='$tut3[avatar]' border='0' alt='$tut3[title]' target='main'></a></div></td>
<td width=208><font color=#82A1FF size=1 face=Verdana, Arial, Helvetica, sans-serif><strong>$tut3[title]</strong><br>
<font color=#000000><em>$tut3[date]</em><br>
By <strong>$tut3[user]</strong></font><br></font></td>
</tr></table>

"; }
}


?>

And the error I get is Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/daniel/public_html/tutorials.php on line 36

- Dan

Tomm
28-01-2006, 03:33 PM
Check your username, password, etc.

DanWilliamson
28-01-2006, 03:35 PM
Hey,

Just to say i'm not to gullible I checked Dbconnect and i'm connected fine.

- Dan


Check your username, password, etc.

Want to hide these adverts? Register an account for free!