Results 1 to 3 of 3

Thread: PHP/MySQL help

  1. #1
    Join Date
    Jan 2006
    Location
    Denton | UK
    Posts
    213
    Tokens
    0

    Default PHP/MySQL help

    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 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

  2. #2
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Check your username, password, etc.

  3. #3
    Join Date
    Jan 2006
    Location
    Denton | UK
    Posts
    213
    Tokens
    0

    Default

    Hey,

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

    - Dan

    Quote Originally Posted by Organised
    Check your username, password, etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •