Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder harlequin2k5's Avatar
    Join Date
    Sep 2005
    Location
    Holiday, FL
    Posts
    635
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Resource ID #7 Error

    I'm trying to use this query that I've used previously but now it's giving me a resource #7 error

    I tried to look the error up on php and couldn't find the answer

    PHP Code:
    <?
    doconnect
    ();

    $query="SELECT * FROM tblUsers";
    $result=mysql_query($query) or die(mysql_error());
    $row=mysql_fetch_array($result);

    echo 
    "<table width=\"90%\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\">\n";
    echo 
    "<tr>\n";
    echo 
    "<th>User Name</th><th>User ID</th><th>User Type</th>\n";
    echo 
    "</tr>\n\n";
    echo 
    "<tr>\n";

    "\n";
    while (
    $row=mysql_fetch_array($result))
    "\n";
        {
    "\n";
        echo 
    "<td>" $row['UserFirstName'] . " " $row['UserLastName'] . "</td><td>" $row['UserID'] . "</td><td>" $row['UserType'] . "</td>\n";
        }

    echo 
    "</tr>\n\n";
    echo 
    "</table>\n";

    ?>
    any help is greatly appreciated

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Hi,

    Take out the \n's that you have in the open, specifically the one right after the while loop:
    PHP Code:
    while ($row=mysql_fetch_array($result))
    {
        echo 
    "<td>" $row['UserFirstName'] . " " $row['UserLastName'] . "</td><td>" $row['UserID'] . "</td><td>" $row['UserType'] . "</td>\n";

    Good luck;


  •  

    Posting Permissions

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