garevn Posted May 11, 2011 Share Posted May 11, 2011 Hello i am a bit confused about the following.Lets say i have a page called pageone which containes a link like this<a href="pagetwo.php"><?php echo $row_char1['charname']; ?></a>This displays the name of the char where id is equal 1 and it links in a page named pagetwo.I want when i go to pagetwo then i display a dynamic table which runs the following query SELECT * FROM PRODUCTS WHERE CHARID = ----->the id value of the selected link like 1 in this case<-----How i have to do something like that using session-arreys or what i am not really experianced ... tnx Link to comment Share on other sites More sharing options...
birbal Posted May 11, 2011 Share Posted May 11, 2011 You need to pass the charID to pagetwo.php something like.. <a href="pagetwo.php?charID=<?php echo $row_char1['charID']; ?>"><?php echo $row_char1['charname']; ?></a> Then you can get the data at pagetwo.php. the data will be avaliable in $_GET array. you can access that value from $_GET['charID'] and an use that in your query. Link to comment Share on other sites More sharing options...
garevn Posted May 11, 2011 Author Share Posted May 11, 2011 hm u mean something like that ?$charid= (isset($_GET['charid'])) ? $_GET['charid'] : NULL;and my querryselect * from products where charid=' " . $charid . " ' Link to comment Share on other sites More sharing options...
birbal Posted May 11, 2011 Share Posted May 11, 2011 yes something like that. you donr need to use concatenate oprator variable value will be evaluated in double quotes and if column is integer data type you should not use single quotes .."select * from products where charid= $charid"; Link to comment Share on other sites More sharing options...
garevn Posted May 11, 2011 Author Share Posted May 11, 2011 tnx for your help bro it works great. i just though had an error on link but i changed it to <a href="pagetwo.php?charID=add&charid=1"><?php echo $row_char1['charname']; ?></a>and works perfect. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.