jermaindefoe Posted November 10, 2009 Share Posted November 10, 2009 Hi every1 i am connecting to a table in sql and the looping through with a while ($ var = my sql fetch array) the question i have is that when i print_r($var) i get the associative array of all elements from what i selected. i need to print a certain column, $row['columnName'] as links that link to a php page named myPHP.php i no i need to use echo "a href = "......" but i just cant get this to work can someone post some example code that i can use to link my links regards Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/ Share on other sites More sharing options...
Adam Posted November 10, 2009 Share Posted November 10, 2009 echo '<a href="'.$row['columnName'].'">...</a>'; ?? Perhaps be easier if you posted some of your code. Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954742 Share on other sites More sharing options...
trq Posted November 10, 2009 Share Posted November 10, 2009 echo "<a href='myPHP.php'>{$row['columnName']}</a>"; Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954743 Share on other sites More sharing options...
jermaindefoe Posted November 10, 2009 Author Share Posted November 10, 2009 echo "<a href='myPHP.php'>{$row['columnName']}</a>"; that worked great thanks do i just concatenate with . "<br/" to add a new line in between Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954746 Share on other sites More sharing options...
Adam Posted November 10, 2009 Share Posted November 10, 2009 Why don't you try it? Assuming you meant "<br />" though.. Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954747 Share on other sites More sharing options...
jermaindefoe Posted November 10, 2009 Author Share Posted November 10, 2009 Ok without giving me an answer in code plse if i have printed my link of all the items in the database, but with my link i want to pass to another form another columnName variable from the same table how would i pass it? hope that makes sence? i would post code but would rather not get in trouble for cheating <hence the "without giving me an answer in code" > part Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954750 Share on other sites More sharing options...
Adam Posted November 10, 2009 Share Posted November 10, 2009 Do you mean to pass another column value through the URL like myPHP.php?something=column_name ? Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954751 Share on other sites More sharing options...
jermaindefoe Posted November 10, 2009 Author Share Posted November 10, 2009 Do you mean to pass another column value through the URL like myPHP.php?something=column_name ? i will just post my code and delete it, that should be fine $result = mysql_query("select * from country"); // load details from country table while($row = mysql_fetch_array($result)){ echo "<a href='theCountry.php'>{$row['name']}</a>" . "<br/>"; //$id = $_POST[$row['id']]; //echo $id; } as far as i know i can pass a value with the links i am printing above so that it can be captured on a new page the value i went to send is from the same table, but it would this time be row[id] instead of row[name] is it possible to send this information, as is it the correct thing for me to do as at the other end when i determine what he country is (via its id ) i can print some bespoke things about it from another part of the database Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954759 Share on other sites More sharing options...
jermaindefoe Posted November 10, 2009 Author Share Posted November 10, 2009 Do you need more information to help me? Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954772 Share on other sites More sharing options...
Adam Posted November 10, 2009 Share Posted November 10, 2009 Not giving the clearest explanation of what you're trying to do. Where exactly does the "value" you wish to pass come from? As I asked before do you mean you wish to pass that value through the URL parameters so you can capture it at the link destination? Link to comment https://forums.phpfreaks.com/topic/180960-printing-links/#findComment-954836 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.