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
https://forums.phpfreaks.com/topic/131893-unable-to-retrieve-members-id/
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.

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

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

Archived

This topic is now archived and is closed to further replies.

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