oceans Posted May 4, 2007 Share Posted May 4, 2007 Dear People, I do sql and populate a table with say 5 column, I want one to be a hyperlink to next page, thus I did the following but it is not working. Where could I have gone wrong? echo "<table>"; $i=0; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td class=FieldName><a herf=/MyPHP/nextpage.php>".$row['Number']."</a></td>"; echo "<td class=FieldName>".$row['STID']."</td>"; echo "<td class=FieldName>".$row['Name']."</td>"; echo "<td class=FieldName>".$row['Add']."</td>"; echo "<td class=FieldName>".$row['Tel']."</td>"; echo "</tr>"; } echo "</table>"; Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/ Share on other sites More sharing options...
trq Posted May 4, 2007 Share Posted May 4, 2007 Invalid html? echo "<table>"; $i=0; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td class='FieldName'><a herf='/MyPHP/nextpage.php'>".$row['Number']."</a></td>"; echo "<td class='FieldName'>".$row['STID']."</td>"; echo "<td class='FieldName'>".$row['Name']."</td>"; echo "<td class='FieldName'>".$row['Add']."</td>"; echo "<td class='FieldName'>".$row['Tel']."</td>"; echo "</tr>"; } echo "</table>"; Please, use the [ code ] [/ code ] tags (no space) when posting code. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245142 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 Thanks this time no error but it is not a hyperlink yet Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245143 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 Friends plase help me, it should be a dot or a corma, please help Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245146 Share on other sites More sharing options...
boo_lolly Posted May 4, 2007 Share Posted May 4, 2007 i believe you can make these a link by using your stylesheet. also, check how your current code reacts to different browsers. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245149 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 Dear Boo-Lolly, My intention is to bring the Number to the next page and show this number and some other staff along with, please assit me, thanks. i do use css, but how shell i do for my intention. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245153 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 people please help, thanks. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245159 Share on other sites More sharing options...
mmarif4u Posted May 4, 2007 Share Posted May 4, 2007 R u using $_GET[] in the next page. Try it like this: <a herf='/MyPHP/nextpage.php?number=".$row['Number']."'>".$row['Number']."</a> In the next nextpage.pgp page get the value: $number=$_GET['number']; Hope this will help. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245171 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 GET is fine, but please echo it, as it will be one of the entity from the sql, please ammend my statement, please. thansk a million. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245177 Share on other sites More sharing options...
mmarif4u Posted May 4, 2007 Share Posted May 4, 2007 These all will be in the nextpage.php $number=$_GET['number']; echo $number; If u get the number there it mean its working. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245179 Share on other sites More sharing options...
ToonMariner Posted May 4, 2007 Share Posted May 4, 2007 Have a look @ a pagination tutorial... http://www.phpfreaks.com/tutorials/73/0.php or http://www.phpfreaks.com/tutorials/43/0.php Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245181 Share on other sites More sharing options...
Silverado_NL Posted May 4, 2007 Share Posted May 4, 2007 your html isnt right " a herf " SHOULD BE " a href" echo "<td class='FieldName'><a hERf='/MyPHP/nextpage.php'>".$row['Number']."</a></td>"; Should BE!!! echo "<td class='FieldName'><a hREf='/MyPHP/nextpage.php'>".$row['Number']."</a></td>"; Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245183 Share on other sites More sharing options...
mmarif4u Posted May 4, 2007 Share Posted May 4, 2007 your html isnt right " a herf " SHOULD BE " a href" echo "<td class='FieldName'><a hERf='/MyPHP/nextpage.php'>".$row['Number']."</a></td>"; Should BE!!! echo "<td class='FieldName'><a hREf='/MyPHP/nextpage.php'>".$row['Number']."</a></td>"; What a nice shoot... Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245184 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 hahaha i am blind, it is working. next please guide how shell i get this number to next page we can use get, nothing sensitive here. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245186 Share on other sites More sharing options...
mmarif4u Posted May 4, 2007 Share Posted May 4, 2007 Read my prev post for GET. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245187 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 i can't get to open the next page, should i give the full address or relative address Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245191 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 ok must use full address, but still could not get to get my number on the next page, i think we should send in this page first right, i don't see we doing it. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245192 Share on other sites More sharing options...
Silverado_NL Posted May 4, 2007 Share Posted May 4, 2007 personally i would pass the id number in the GET method through the link you just made lets say your pages contain messages. then if you want certain pages to appear you will have to apply the LIMIT into your sql lets say the link = is like followed echo "<td class='FieldName'><a href='/MyPHP/nextpage.php?start=".$row['Number'].">".$row['Number']."</a></td>"; will output a link something like nextpage.php?start=15 then in your php script call for the $_GET['start'] id. and execute the page query like this. ---> simple example ----> mysql_query("SELECT * FROM TABLE LIMIT 1,15"); $number_of_messages = 5; ---> real deal ---------->mysql_query("SELECT * FROM TABLE LIMIT '$_GET['start']','$number_of_messages' "); THE LIMIT FUNCTION in the query will make sure your query only selects the needed messages, "LIMIT 323,10" will cause the query to skip selecting the 323 first messages en only select the 10 after 323. so "LIMIT 323,10" will select 323,324,325,32..... and so "LIMIT 19,2" will select 19 AND 20 Hope this helps Greeting Silverado Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245195 Share on other sites More sharing options...
Silverado_NL Posted May 4, 2007 Share Posted May 4, 2007 What a nice shoot... thank you:) my programming skills where so terrible on the beginning, that i turned into a "PRO syntax error searching machine" i can distinguishe a dot from a comma from over 2 meter away from my screen:) Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245196 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 Dear Silver, It appears to work but the parant page is unsightly, the following on acreen as hyper text, " <a href='/MyPHP/Service/ST/nextpage.php?start=45>45 " what i shoud be seeing is " 45 " where PP45 is the value for Number Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245199 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 further i only get to see one entry. but i should see more rows as there are a few result rows. please help, we are there... an inch more.. Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245202 Share on other sites More sharing options...
Silverado_NL Posted May 4, 2007 Share Posted May 4, 2007 please post the related code here in the forum put in between CODE tags!!!!! "<a href='/MyPHP/Service/ST/nextpage.php?start=45>45" what i shoud be seeing is "45" you probely did not close the A TAGS so it should be like this!!!! echo "<a href='/MyPHP/nextpage.php?start=".$row['Number'].">".$row['Number']."</a>"; further i only get to see one entry. is your LIMIT written as it should be???? please show your code and put it between the CODE TAGS Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245207 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 [/code/] while($row = mysql_fetch_assoc($result)) { echo "<td class='FieldName'><a href='/MyPHP/Service/ST/NewPage.php?start=".$row['Number'].">".$row['Number']."</a></td>"; echo "<td class=FieldName>".$row['STID']."</td>"; echo "<td class=FieldName>".$row['Name']."</td>"; echo "<td class=FieldName>".$row['Address']."</td>"; echo "</tr>"; } echo "</table>"; [/code/] Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245209 Share on other sites More sharing options...
Silverado_NL Posted May 4, 2007 Share Posted May 4, 2007 [/code/] while($row = mysql_fetch_assoc($result)) { echo "<td class='FieldName'><a href='/MyPHP/Service/ST/NewPage.php?start=".$row['Number'].">".$row['Number']."</a></td>"; echo "<td class=FieldName>".$row['STID']."</td>"; echo "<td class=FieldName>".$row['Name']."</td>"; echo "<td class=FieldName>".$row['Address']."</td>"; echo "</tr>"; } echo "</table>"; [/code/] these still arent the right tags:):) open with [ CODE ] without spaces. and close em with [ / CODE ] also without spaces cause if you dont. echo "<td class='FieldName'><a href='/MyPHP/nextpage.php?start=".$row['Number'].">".$row['Number']."</a></td>"; will turn into echo "<td class='FieldName'><a href='/MyPHP/nextpage.php?start=".$row['Number'].">".$row['Number']."[/url]</td>"; notice the A CLOSING TAG CHANGED INTO AND URL CLOSING TAG????? Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245213 Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 Sorry i can't catch you. can you mod my code, I am with this problem for 4 hrs now! Link to comment https://forums.phpfreaks.com/topic/49941-solved-make-hyperlink-in-dynamic-listing/#findComment-245217 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.