Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-23-2010, 12:50 PM URL Questions
Experienced Talker

Posts: 45
Trades: 0
Sorry I'm posting to much ( If I am ). I'm new to PHP here and the questions I have are not always easy to answer unless you know what the functions/ variables are called.

Anyways, my website basically grabs 1 random row from the database then adds data from that row into the page.

What I want to do is use the "Primary Key" which auto imcrements as the URL. When I query the database the entire row is stored in the variable $row. Any ideas of how I can do this?

For example, here's what I want: http://URL-Goes-Here.com/page?=1 (1 = $row id. )
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
Thizzle is offline
Reply With Quote
View Public Profile Visit Thizzle's homepage!
 
 
Register now for full access!
Old 07-23-2010, 05:03 PM Re: URL Questions
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
When you run your query make sure to select the 'id' field in addition to whatever else you want to grab. Your php to grab the row probably looks similar to:

Code:
$result = mysql_query("Your query here");
$row = mysql_fetch_row($result);
You can access the id as $row['id'] so maybe

$row_id = $row['id'];

and then use that value in building your URL. Based on your example it looks like you would already know everything other than the id so you might do something like:

$url = "http :// url-goes-here.com/page?=" . "$row_id";

The spaces in the above before and after :// are just to prevent the forum from turning it into an active link.

And by the way don't worry about asking too many questions. You're asking to learn and we're here to help if we can.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to URL Questions
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.76254 seconds with 12 queries