Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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