p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > PHP/MySQL > PHP Databases
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 3rd, 2009, 07:47 AM
Authorized User
Points: 217, Level: 4
Points: 217, Level: 4 Points: 217, Level: 4 Points: 217, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , , .
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to view my data in my database in a certain items?

Hi,

Im quite new in php mysql, i have a problem regarding on how to view a single item, like for example, im my database i have a table name called "list" in my table i have "id, title,firstname,lastname, status" and id is my primary key, now i have no problem in displaying my data in all, what i want is like for example i have a record in my database like:

ID TITLE FIRSTNAME LASTNAME STATUS
view 1 REGISTER JHON CRUZ SINGLE
view 2 REGISTER JHON1 CRUZ MARRIED
view 3 REGISTER JHON2 CRUZ SINGLE

Now my problem is how im going to make a certain code that if i have to click the " view" only in person will appear let say if im going to click view from id 1 only the profile of JHON will display. 1 hope i made it clear. sori my english is bad.

jhanny
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old March 6th, 2009, 12:43 AM
Authorized User
Points: 60, Level: 1
Points: 60, Level: 1 Points: 60, Level: 1 Points: 60, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Default

am summarizing ur needs

- You want to list the whole users in a table
- Each user has a view link near to each row
- when u click on it, u want to show his/her full details in another page

PHP Code:
$get_users "SELECT `id`, `firstname` FROM `your_table` ORDER BY `id`;
$get_users_qr = mysql_query($get_users);
while($get_users_obj = mysql_fetch_array($get_users_qr)) {
      echo $get_users_obj['firstname']." 
<a href='details.php?id=".$get_users_obj['id']."'>View Details</a><br/>";

This will list your whole db users list with view details link
=============================================

In details.php

get the id and list its details

PHP Code:
$user_id $_GET['id'];
$get_details "SELECT * FROM `your_table` WHERE `id`='".$user_id."'";
$get_details_qry mysql_query($get_details);
if(
$get_details_obj mysql_fetch_array($get_details)) {
   echo 
"First Name:".$get_details_obj['firstname'];
  echo 
"<br> Last Name:".$get_details_obj['lastname'];

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Placing database items into a list box hookenbook Visual Basic 2005 Basics 2 January 14th, 2009 08:56 PM
how to view the checked items after navigating madhusrp C# 1 January 24th, 2006 03:28 PM
Help, trying to fill grid w/database items itsajourney ADO.NET 1 May 24th, 2005 11:57 PM
Listing and limiting items from a database RPG SEARCH ASP.NET 1.0 and 1.1 Basics 11 August 3rd, 2004 05:37 PM
displaying items from a database?? Ashleek007 PHP Databases 3 April 27th, 2004 07:05 PM



All times are GMT -4. The time now is 04:43 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc