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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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