karnegyhall Posted May 22, 2009 Share Posted May 22, 2009 hello - I'm using the php session function. i've got a 'login splash page' and another 'edit profile' page. what i need is for users to be able to make entries to their profiles, execute it, and for the page to loop back to the 'login splash page' and show the updates. How the hell do most people accomplish this? Is there a standard way? My php session uses the SESS_MEMBER_ID variable. But when i do a Select statement on the corresponding MySQL variable it pulls zeros. HELP! <?php require_once('sports-auth.php'); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Member Index</title> <link href="sportsCSSmod.php" rel="stylesheet" type="text/css" /> </head> <body> <h1>Welcome <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1> <?php $conn = mysql_connect("Host", "database", "password"); if (!$conn) { die('Could not connect: ' . mysql_error()); } $select = mysql_select_db('sportstalkadmin', $conn); if (!$select) { die('could not select db: sportstalkadmin ' . mysql_error()); } $Lastid2 = $_SESSION['SESS_MEMBER_ID']; $query = "SELECT strUserName FROM tblathletes WHERE intAthleteID = $Lastid2"; $query2 = "SELECT intJerseyNumber FROM tblathletes WHERE intAthleteID = $Lastid2"; $query3 = "SELECT intHeight FROM tblathletes WHERE intAthleteID = $Lastid2"; $query4 = "SELECT intWeight FROM tblathletes WHERE intAthleteID = $Lastid2"; $query5 = "SELECT strEMailAddress FROM tblathletes WHERE intAthleteID = $Lastid2"; $result = mysql_query($query) or die(mysql_error()); $result2 = mysql_query($query2) or die(mysql_error()); $result3 = mysql_query($query3) or die(mysql_error()); $result4 = mysql_query($query4) or die(mysql_error()); $result5 = mysql_query($query5) or die(mysql_error()); echo "you are: "; while($row = mysql_fetch_array($result)) echo $row['strUserName']; echo " "; echo "Jersey number: "; while($row2 = mysql_fetch_array($result2)) echo $row2['intJerseyNumber']; echo "height: "; while($row3 = mysql_fetch_array($result3)) echo $row3['intHeight']; echo "Weight: "; while($row4 = mysql_fetch_array($result4)) echo $row4['intWeight']; echo "Email Address: "; while($row5 = mysql_fetch_array($result5)) echo $row5['strEMailAddress']; echo $Jersey; mysql_close($conn); ?> <a href="sports-memberprofile.php">Edit/Create Profile</a> | <a href="sports-logout.php">Logout</a> <p>Your profile </p> </body> </html> Link to comment https://forums.phpfreaks.com/topic/159289-tying-in-post-data-with-sess_member_id/ Share on other sites More sharing options...
gevans Posted May 22, 2009 Share Posted May 22, 2009 Firstly I'd recommend hitting a few SQL tutorials, you're ruuning a lot of queries where only one is required <?php $query = "SELECT strUserName FROM tblathletes WHERE intAthleteID = $Lastid2"; $query2 = "SELECT intJerseyNumber FROM tblathletes WHERE intAthleteID = $Lastid2"; $query3 = "SELECT intHeight FROM tblathletes WHERE intAthleteID = $Lastid2"; $query4 = "SELECT intWeight FROM tblathletes WHERE intAthleteID = $Lastid2"; $query5 = "SELECT strEMailAddress FROM tblathletes WHERE intAthleteID = $Lastid2"; should be <?php $query = "SELECT strUserName, intJerseyNumber, intHeight, intWeight, strEMailAddress FROM tblathletes WHERE intAthleteID = $Lastid2"; Link to comment https://forums.phpfreaks.com/topic/159289-tying-in-post-data-with-sess_member_id/#findComment-840135 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.