Jump to content

unable to retrieve members id


SUNIL16

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ;D

Link to comment
Share on other sites

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'
)");

Link to comment
Share on other sites

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.