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
https://forums.phpfreaks.com/topic/237463-select-from-tabel-where-idid/
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.