Jump to content

[SOLVED] Make hyperlink in dynamic listing


oceans

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

[/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
Share on other sites

[/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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.