General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 21st, 2002, 10:18 AM
Teckniel Teckniel is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 1 Teckniel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Small problem

if i enter a url like
URL


how can i see the artikel with id 6
on the page??
and just that artikel with id 6??

Reply With Quote
  #2  
Old September 21st, 2002, 11:21 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
this means that your sending a get variable to the server.

a simple example would be

echo $_GET['artikelid'];


so in your case it would print out 6, you can then use this variable to query a database or do anything you like with it

Reply With Quote
  #3  
Old September 21st, 2002, 11:23 AM
Joe4JC Joe4JC is offline
The name's Joe. Yours?
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Lurking in the shadows...
Posts: 147 Joe4JC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Cheers, m8, try this:

PHP Code:
<?php
$id 
$_GET['artikelid'];

$query "SELECT * FROM your_table WHERE id='$id'";

$connect mysql_connect('localhost''user''password');
$select mysql_select_db('yourdb'$connect);
$result mysql_query($query) or die('MySQL error: '.mysql_error().'. Error #'.mysql_errno());
if (
mysql_num_rows($result) >= 1) {
while(list(
$data) = mysql_fetch_row($result)) {
echo 
$data;
}
mysql_free_result($result);
mysql_close($connect);
?>


Also, reading the manual helps too!

Good luck,
Joe of 4Life

[edit]I assume that the article is in a MySQL database. Is it?[/edit]
__________________
Check out 4Life today!

Last edited by Joe4JC : September 21st, 2002 at 11:28 AM.

Reply With Quote
  #4  
Old September 21st, 2002, 11:25 AM
Joe4JC Joe4JC is offline
The name's Joe. Yours?
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Lurking in the shadows...
Posts: 147 Joe4JC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Wow Ben, you posted before I could! Well, actually it took me 20 mins to type that because I was trying to do a million other things at once! lol

Cheers,
Joe of 4Life

Reply With Quote
  #5  
Old September 21st, 2002, 12:42 PM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m
Reputation Power: 7
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
Joe4JC's code is basically what you are going to need to do. You will need to make changes in order for it to fit your website's style, database structure, etc..

For more indepth explanation on retrieving data from a specifc row in a table can be found in Ben's PHP & MySQL basics tutorial.
__________________




"Only Linux users see the end of crashes."
- Pl4t0

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Small problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway