SUNIL16 Posted November 8, 2008 Share Posted November 8, 2008 Hi Friends, I am unable to retrieve members id. in my file members.php below is my code <?php require "config.php"; // All database details will be included here $page_name="members.php"; $tbl_name="users"; $start=$_GET['start']; if(!($start > 0)) { $start = 0; } $eu = ($start - 0); $limit = 10; // No of records to be shown per page. $this1 = $eu + $limit; $back = $eu - $limit; $next = $eu + $limit; $query2=" SELECT * FROM $tbl_name "; $result2=mysql_query($query2); echo mysql_error(); $nume=mysql_num_rows($result2); echo"<table width='90%' border='0' align='center' cellpadding='3' cellspacing='1' bgcolor='#CCCCCC'> <tr> <td width='6%' align='center' bgcolor='#E6E6E6'><strong>#</strong></td> <td width='53%' align='center' bgcolor='#E6E6E6'><strong>Name</strong></td> <td width='15%' align='center' bgcolor='#E6E6E6'><strong>Date/Time of Joining</strong></td> </tr>"; $query=" SELECT * FROM $tbl_name limit $eu, $limit "; $result=mysql_query($query); echo mysql_error(); while($row=mysql_fetch_array($result)){ // Start looping table row echo "<tr>"; echo "<td bgcolor='#FFFFFF'>"; echo $row['usersid']; echo "</td>"; echo "<td bgcolor='#FFFFFF'>"; echo "<a href='userprofile.php?id=".$row['usersid']."'>".$row['username']."</a><BR></td>"; echo "<td align='center' bgcolor='#FFFFFF'>"; echo $row['date']; echo "</td>"; echo "</tr>"; // Exit looping and close connection } in the output its showing username with a link but not getting userid. Quote Link to comment Share on other sites More sharing options...
xcoderx Posted November 8, 2008 Share Posted November 8, 2008 show the site have to check it first coz cant understand this way Quote Link to comment Share on other sites More sharing options...
xcoderx Posted November 8, 2008 Share Posted November 8, 2008 could you show the table structure? Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted November 8, 2008 Share Posted November 8, 2008 It looks like there is no `usersid` column in your table. This is why writing out all your column names that you want to select is a good idea: $query=" SELECT usersid, username, date FROM $tbl_name limit $eu, $limit "; Now if the `usersid` column doesn't exist, you'll get an error saying so. Quote Link to comment Share on other sites More sharing options...
xcoderx Posted November 8, 2008 Share Posted November 8, 2008 It looks like there is no `usersid` column in your table. This is why writing out all your column names that you want to select is a good idea: $query=" SELECT usersid, username, date FROM $tbl_name limit $eu, $limit "; Now if the `usersid` column doesn't exist, you'll get an error saying so. right said Jeremysr even i thought so Quote Link to comment Share on other sites More sharing options...
blueman378 Posted November 8, 2008 Share Posted November 8, 2008 is your column name possibly userid? not usersid Quote Link to comment Share on other sites More sharing options...
SUNIL16 Posted November 10, 2008 Author Share Posted November 10, 2008 Hi All, This is my table structure mysql_query("CREATE TABLE users ( usersID int NOT NULL AUTO_INCREMENT, PRIMARY KEY (usersID), `username` varchar(30)NOT NULL default'0', `password` varchar(30)NOT NULL default'0', `email` varchar(40)NOT NULL default'0', `fullname` varchar(30)NOT NULL default'0', `about` longtext NOT NULL, `country` varchar(20)NOT NULL default'0', `location` varchar(30)NOT NULL default'0', `agree` varchar(5)NOT NULL default'0', `date` varchar(30) NOT NULL default'0' )"); Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted November 10, 2008 Share Posted November 10, 2008 Table names are case-sensitive, so 'usersid' is different than 'usersID'. You'll have to access the value like this: $row['usersID'] Quote Link to comment Share on other sites More sharing options...
xcoderx Posted November 10, 2008 Share Posted November 10, 2008 $query = " SELECT usersID, username, date FROM users limit $eu, $limit "; now that will work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.