Jump to content

link issues


johnh2009

Recommended Posts

Introductions 1st :)  Hi all im john, im very new to PHP.  I made a fansite for F1 sim racing a few years ago but didnt carry it on, now im reteaching myself but its not going too well.

 

I woul dbe very grateful for any help anyone can give

 

I made a website for my F1 simracing a while back, anyway the linking i used is no longer working.

 

i use this link:

 

echo “”. $shownews .”…….Read More“;

 

the url address has the id in it ie: news.php?nid=13

 

and the news page has the following in it:

 

$kysely = mysql_query(”select * FROM igpcnews WHERE id=’$nid’”,$yhteys);

 

but i always get

 

Notice: Undefined variable: nid in C:\wamp\www\site\news.php on line 41

 

This used to work a few years ago, im guessing the newer PHP dont work the same as the older because i dont know whats up with it.

 

Can anyone help??

 

Link to comment
https://forums.phpfreaks.com/topic/176199-link-issues/
Share on other sites

I'm guessing you were relying on the register_globals setting being On back then. You access GET variables (the ones set via the URL) with $_GET['name'], so in your case you could simply assign the correct variable to $nid, before using it:

 

$nid = $_GET['nid'];

This also applies to POST variables (the ones sent via an HTML form), where the value of a text field named name is accessed with $_POST['name'].

Link to comment
https://forums.phpfreaks.com/topic/176199-link-issues/#findComment-928538
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.