Jump to content

Problems with calling MYSQL data


maxihobbs

Recommended Posts

Im creating an online football community site for members to join and I'm having trouble retrieving the data from MYSQL, it works fine on my other pages, any ideas would be grateful.

 

Thanks

 

<?php

 

mysql_connect("localhost", "root", "") or die(mysql_error());

mysql_select_db("robinstalk") or die(mysql_error());

 

if (isset($_GET['id'])) {

    // connect to database.

    $sql = "SELECT * FROM users WHERE first = '{$_GET['member']}'";

    $result = mysql_query($sql);

    if ($result) {

      if (mysql_num_rows($result) > 0) {

        $row = mysql_fetch_assoc($result);

        echo "<br />

  <br />

      {$row['first']}

      <br />

  <br />

  Last Name : {$row['last']}

  <br />

  <br />

  Email : {$row['email']}

  <br />

  <br />

  About : {$row['about']}

 

  ";

 

      } }

  }

?>

 

This page is called view_profile.php and is supposed to show the user, that members data, the page beforehand is called members.php

Link to comment
https://forums.phpfreaks.com/topic/194656-problems-with-calling-mysql-data/
Share on other sites

as schilly suggested, try verifying that $_GET['id'] is set. also try echoing the raw query itself to see that it is what you expect. try creating an else clause for the first if (not any of the nested ones) to see if that first isset(...) check is false or true

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.