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>"; Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
oceans Posted May 4, 2007 Author Share Posted May 4, 2007 people please help, thanks. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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>"; Quote Link to comment 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... Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted May 4, 2007 Share Posted May 4, 2007 Read my prev post for GET. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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:) Quote Link to comment 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 Quote Link to comment 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.. Quote Link to comment 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 Quote Link to comment 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/] Quote Link to comment 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????? Quote Link to comment 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! Quote Link to comment 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.