Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

77 users online



News id="bla"

News id="bla"

Currently viewing this thread: 1 (0 members and 1 guests)


Page 1 out of 3
X-plozive

X-plozive

Status: Offline!

News id="bla"

I have made a simple news script, but I want the news to be www.bla.com/news.php?id=1 and so on, so can somebody help me with it. I know how to make it so it can link to it, just not so it can be like that Shocked

phpmonkey

phpmonkey

whoa, wtf?
Status: Offline!

I don't quite understand try explaining again, and what do you mean 'link to it'

___________________

Fomerly known as lasnaranjas. Holler.
http://card.mygamercard.net/gelsig/blackdood.png

X-plozive

X-plozive

Status: Offline!
PHP:

<?php

$link 
mysql_connect("localhost","sdbz_game","hide"); 
    
mysql_select_db("sdbz_gamedb",$link); 
    
$result mysql_query("SELECT * FROM news WHERE id='$id' limit 10") or die (mysql_error());

?>

There's the code I've got so far, some guy tells me I need to do

PHP:

<?php

if ( $id == ); 

then some crap here...

elseif ( 
I dont know Sad)

?>

OmicronSoftware

OmicronSoftware

Neverside Newbie
Status: Offline!

Ah, so you're wanting to link to individual news items through the ID url variable? I'll dig out some code if Jerome doesn't beat me to it.Tongue

___________________

Omicron Software UK
http://www.omicron-software.co.uk

Zeratul

Zeratul

kage
Status: Offline!
PHP:

<?php
$id 
$_GET['id'];
$link mysql_connect("localhost","sdbz_game","hide"); 
    
mysql_select_db("sdbz_gamedb",$link); 
    
$result mysql_query("SELECT * FROM news WHERE id='$id' limit 10") or die (mysql_error());
?>

Then write an if the else statement so that the script will display an error message stating that there is no such id.

Last edited by Zeratul, July 20th, 2004 08:25 PM (Edited 1 times)

phpmonkey

phpmonkey

whoa, wtf?
Status: Offline!

Oh, I know what you're asking. Google for it. I know phpdeveloper has articles, so does devshed.com, and if you must, spoono.com

___________________

Fomerly known as lasnaranjas. Holler.
http://card.mygamercard.net/gelsig/blackdood.png

Zeratul

Zeratul

kage
Status: Offline!

I already showed him the solution Smile

X-plozive

X-plozive

Status: Offline!

Now is that all I need to do?

So watch should I put in the IF and Else parts, I know Im dumb Tongue

Last edited by X-plozive, July 20th, 2004 08:36 PM (Edited 1 times)

Zeratul

Zeratul

kage
Status: Offline!

Ok, I'll put it in English :P
If $id exceeds the number of rows in the database,
display an error message.
If $id is not found in the database,
display an error message.

X-plozive

X-plozive

Status: Offline!
PHP:

<?php

if ($id == )
What do I put here?

elseif ( 
$id == huh )
echo 
'Error: Sorry, News ID cannot be found!!!'

?>

Page 1 out of 3
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0087 seconds.