daybyday Posted May 25, 2011 Share Posted May 25, 2011 Hey, have used a long time on this... i hope you guys can help me - 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 xD... and then post the infomation for the 'name' of the link i clicked well here is my code 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 xD i hope you understand my stupidity and know how to fix my problem 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>"; } Quote Link to comment https://forums.phpfreaks.com/topic/237463-select-from-tabel-where-idid/ Share on other sites More sharing options...
Drummin Posted May 25, 2011 Share Posted May 25, 2011 Looks like you're missing grabbing the value of id. Add this to the top of klub.php. $id=$_GET['id']; Quote Link to comment https://forums.phpfreaks.com/topic/237463-select-from-tabel-where-idid/#findComment-1220218 Share on other sites More sharing options...
daybyday Posted May 25, 2011 Author Share Posted May 25, 2011 Looks like you're missing grabbing the value of id. Add this to the top of klub.php. $id=$_GET['id']; Hahahaha ... no way ... i used hours in this THX it works like a charm Quote Link to comment https://forums.phpfreaks.com/topic/237463-select-from-tabel-where-idid/#findComment-1220224 Share on other sites More sharing options...
Maq Posted May 25, 2011 Share Posted May 25, 2011 @daybyday, in the future, please place tags around your code. Quote Link to comment https://forums.phpfreaks.com/topic/237463-select-from-tabel-where-idid/#findComment-1220262 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.