maxihobbs Posted March 9, 2010 Share Posted March 9, 2010 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 More sharing options...
mikesta707 Posted March 9, 2010 Share Posted March 9, 2010 what happens exactly? blank page? wrong info? query seems to fail? error message? a little more info is needed Link to comment https://forums.phpfreaks.com/topic/194656-problems-with-calling-mysql-data/#findComment-1023735 Share on other sites More sharing options...
schilly Posted March 9, 2010 Share Posted March 9, 2010 <?php $result = mysql_query($sql) or die(mysql_error()); ?> Is $_GET['id'] and $_GET['member'] set? What is happening on this page? Nothing showing up? Link to comment https://forums.phpfreaks.com/topic/194656-problems-with-calling-mysql-data/#findComment-1023736 Share on other sites More sharing options...
maxihobbs Posted March 9, 2010 Author Share Posted March 9, 2010 Sorry forgot that bit! Blank page, nothing shown at all Link to comment https://forums.phpfreaks.com/topic/194656-problems-with-calling-mysql-data/#findComment-1023737 Share on other sites More sharing options...
mikesta707 Posted March 9, 2010 Share Posted March 9, 2010 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 Link to comment https://forums.phpfreaks.com/topic/194656-problems-with-calling-mysql-data/#findComment-1023738 Share on other sites More sharing options...
maxihobbs Posted March 9, 2010 Author Share Posted March 9, 2010 SOLVED! Thanks a bunch, learning these things fast! Link to comment https://forums.phpfreaks.com/topic/194656-problems-with-calling-mysql-data/#findComment-1023740 Share on other sites More sharing options...
mikesta707 Posted March 9, 2010 Share Posted March 9, 2010 you can click the green mark solved button at the bottom of the thread to mark this topic as solved Link to comment https://forums.phpfreaks.com/topic/194656-problems-with-calling-mysql-data/#findComment-1023741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.