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

January 3rd, 2009, 07:47 AM
|
|
Authorized User
|
|
Join Date: Oct 2006
Location: , , .
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

March 6th, 2009, 12:43 AM
|
|
Authorized User
|
|
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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']; }
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |