Hyperlink for the values of the database dynamically.. problem

i have a problem in generating the hyperlinks dynamically for the mysq

Page 1 of 1

4 Replies - 999 Views - Last Post: 10 August 2009 - 10:47 PM Rate Topic: -----

#1 amulmanu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 02-August 09

Hyperlink for the values of the database dynamically.. problem

Post icon  Posted 10 August 2009 - 10:05 PM

Hi Friends..

I have a doubt in generating hyperlinks dynamically for the values which are accessed from the Mysql database...

i have an image for my report i have attached it.. please find it..

--- here i printed the fields

for($i=1; $i<$fields_num; $i++)
{	
$field = mysql_fetch_field($result);	
}
// printing table rows

while($row = mysql_fetch_row($result))
{	
echo "<tr class='gentext' style='padding-top:2px; padding-bottom:2px;'>";	
// $row is array... foreach( .. ) puts every element	
// of $row to $cell variable	
foreach($row as $cell)		
echo "<td class='gentext' width='100px'>$cell</td>"; 
}



atlast i printed the cell values it prints horizontally.. all the values at a time...

my problem is to generate the hyperlinks for the $cell values dynamically...

from the follwing attachment.. it has different fields i need to link these field values to the other php...

i mean that for example...

i have no.of circles... when i want to see those circles list i should go to the another php to list all the values of circles..

can any one help me.. plzzz

Thanks in Advance...

Attached File(s)



Is This A Good Question/Topic? 0
  • +

Replies To: Hyperlink for the values of the database dynamically.. problem

#2 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: Hyperlink for the values of the database dynamically.. problem

Posted 10 August 2009 - 10:16 PM

add link tag in your code
echo "<td class='gentext' width='100px'><a href='pagename.php'>$cell</a></td>";
Was This Post Helpful? 0
  • +
  • -

#3 amulmanu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 02-August 09

Re: Hyperlink for the values of the database dynamically.. problem

Posted 10 August 2009 - 10:25 PM

View Postnoorahmad, on 10 Aug, 2009 - 09:16 PM, said:

add link tag in your code
echo "<td class='gentext' width='100px'><a href='pagename.php'>$cell</a></td>";


Hi thanks for giving the express reply...

kk its right.. but $cell is printing the records at a time and i want to link each field value of a record to other php..

did u get my problemm...

for example for CZ record--> for every field value i.e

from no.of Circles....end of the table i use to generate hyperlinks...

Thanks In advance..
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5191
  • View blog
  • Posts: 26,903
  • Joined: 10-May 07

Re: Hyperlink for the values of the database dynamically.. problem

Posted 10 August 2009 - 10:26 PM

Because each result is pulled individually, they are in return values of the row array. Based on your select statement, $row[0] is the 1st result, $row[1] is the 2nd & so on. Not the number of result pulled, but the number of select. So assuming you are pulling select value from ..., each value pulled from the database will fill $row[0] each time. Now if you have two values to pull, such as select value1, value2 from ... then $row[0] will contain value1 & $row[1] will contain value2, & this is for each iteration of your while loop.

while($row = mysql_fetch_row($result)) {	
  echo "<tr class='gentext' style='padding-top:2px; padding bottom:2px;'>";	
  echo "<td class='gentext' width='100px'>$row[0]</td></tr>";
}




If non of this is correct to your situation, could you post the HTML code (not the php code) that you are getting, & then compare that to the HTML code that you are trying to produce.
Was This Post Helpful? 0
  • +
  • -

#5 amulmanu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 02-August 09

Re: Hyperlink for the values of the database dynamically.. problem

Posted 10 August 2009 - 10:47 PM

View Postno2pencil, on 10 Aug, 2009 - 09:26 PM, said:

Because each result is pulled individually, they are in return values of the row array. Based on your select statement, $row[0] is the 1st result, $row[1] is the 2nd & so on. Not the number of result pulled, but the number of select. So assuming you are pulling select value from ..., each value pulled from the database will fill $row[0] each time. Now if you have two values to pull, such as select value1, value2 from ... then $row[0] will contain value1 & $row[1] will contain value2, & this is for each iteration of your while loop.

while($row = mysql_fetch_row($result)) {	
  echo "<tr class='gentext' style='padding-top:2px; padding bottom:2px;'>";	
  echo "<td class='gentext' width='100px'>$row[0]</td></tr>";
}




If non of this is correct to your situation, could you post the HTML code (not the php code) that you are getting, & then compare that to the HTML code that you are trying to produce.



------------

Thanks for helping mee...

i got ur solution..

but i need to keep different php's for the all the values of the data as shown in the figure..

can u plz find the attachment for my problemm...
i have attached a screen which was developed by the html...

like wise i used to develop my php page by geenerating all the hyperlinks for both rows and columns...

the contains showing the one record links like wise i shoulg get to all the table valuess...

....

Thanks In Advance...

This post has been edited by amulmanu: 10 August 2009 - 10:49 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1