Jump to content

"SELECT * FROM tabel WHERE id='$id'


daybyday

Recommended Posts

Hey, have used a long time on this... i hope you guys can help me :D

- im new in the php / mysql world.

so here it is:

i want to make a list on my first page that post links (list.php)

list.php works fine, i get a list of links from my database, and when i click on it it goes to test.com/klub.php?id= (and the id for the tabel) fx. test.com/klub.php?id=000000018.

so i think the problem is in my klub.php, here i want to select * from siteinfo1 where id = the same id as i get from clicking the link on the other site :D xD...

and then post the infomation for the 'name' of the link i clicked :D

well here is my code :D i think the problem is

$result = mysql_query("SELECT * FROM siteinfo1 WHERE id='$id'");

for if i change the id=$id to id=000000018 it post the info for the table whit that id nr... but then i cant see all the other info i need form 000000019 and so on :D xD

i hope you understand my stupidity and know how to fix my problem :D thx...

 

_________________________________________

list.php

_________________________________________

 

$result1 = mysql_query("SELECT * FROM siteinfo1") or die (mysql_error());

 

while($row1 = mysql_fetch_array($result1))

{

echo "<A href=\"klub.php?id={$row1['id']}\">{$row1['navn']}</A>";

echo "</br>";

}

 

_________________________________________

klub.php

_________________________________________

 

$result = mysql_query("SELECT * FROM siteinfo1 WHERE id='$id'");

 

while($row = mysql_fetch_array($result))

{

echo "$row[id]";

echo "</br>";

echo "Navn: ";

echo "$row[navn]";

echo "</br>";

}

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.