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

Thread: mysql error

  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts

    mysql error

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /path/public_html/account.php on line 21

    Code:
    <?php session_start(); ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Account Dashboard</title>
    </head>
    <body>
    <?php
    include('dbsettings.php');
    
    $con = mysql_connect("$host","$user","$password");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("$db", $con);
    
    $result = mysql_query("SELECT * FROM $tbl_name" );
    
    while($row = mysql_fetch_array($result))
      {
      echo $row['FirstName'] . " " . $row['LastName'];
      echo "<br />";
      }
    
    mysql_close($con);
    ?>
    <a href="logout.php"> Log Out </a>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,454
    Thanks
    71
    Thanked 102 Times in 101 Posts
    I am not seeing $tbl_name defined anywhere. That would be a problem

    PHP Code:
    $result mysql_query("SELECT * FROM $tbl_name"); 
    Also are you going to use WHERE in the query? I always prefer it.

  • #3
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Okay it works like a charm, but since i md5 everything when user registers, when i retrieve it from the database, how do I un-md5 it so when the user looks at it, it doesn't appear as gibberish?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    See the other thread you have opened regarding this.


  •  

    Tags for this Thread

    Posting Permissions

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