Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 3rd, 2009, 07:47 AM
Authorized User
 
Join Date: Oct 2006
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
 
Old March 6th, 2009, 12:43 AM
Authorized User
 
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'];






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 10:57 PM
Listing and limiting items from a database RPG SEARCH ASP.NET 1.0 and 1.1 Basics 11 August 3rd, 2004 04:37 PM
displaying items from a database?? Ashleek007 PHP Databases 3 April 27th, 2004 06:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.