Hello Folks, i am in some mess as it seems, i have created a PHP Site with that i write different informations in different cells of that mysql table. the writing into the table works fine and without any problem... the table looks like this : ID1 Value1 Value2 ID2 Value3 Value4 now when doing a result approach on that table i want to have a page generated with the view like this : Value1(shown as hyperlink) Value2(Simple Text) Value3(shown as hyperlink) Value4(Simple Text) .... i mainly got probs with generating the part where the Value1 information (is shown as hyperlink) where i connect the id with the Value1 cell and giving that out as hyperlink. the script that i am using to show the result yet is this one : <?php include ('dbconnect.php'); $sel = "SELECT * FROM table ORDER by Value1"; $result = mysql_query($sel); while($row = mysql_fetch_object($result)) { $site = ""; if(trim($row->link) != ""){ $site = "<a href='".$row->link."'>WebSite</a>"; } echo "<table border=0 style='width: 450px'> <tr> <td style='width: 150px'>$row->Value1 </td> <td style='width: 150px'>$row->Value2 </td> <td style='width: 120px'>$row->Value3 </td> <td style='width: 120px'>$webseite </td> </tr> </table> <br>"; } to put it in my own words... i wish to see as result a table where the information from the Value1-Row is shown as hyperlink and when clicked you can go to a "detailpage" where you can get additional informations about that entry, but the tricky in my view is that the information in that row actually is only a text. i hope i could explain my problem well and i would appreciate it a lot if someone here could give me an advice or a hint on how to create that script part. many thanks in advance, your PHPDummy
this line is wrong <td style='width: 120px'>$webseite </td> Code (markup): cause you set the $site variable but looking for $webseite afterwards so it should be like this: <td style='width: 120px'>$site </td> PHP:
Try something more like this: <?php include ('dbconnect.php'); $sel = "SELECT * FROM table ORDER by Value1"; $result = mysql_query($sel); echo "<table border='0' style='width: 450px'> while($row = mysql_fetch_object($result)) { if(trim($row->link) != ""){ echo"<tr><td style='width: 150px'><a href='$row->link'>$row->Value1</a></td></tr>"; echo"<tr><td style='width: 150px'><a href='$row->link'>$row->Value2</a></td></tr>"; echo"<tr><td style='width: 120px'><a href='$row->link'>$row->Value3</a></td></tr>"; echo"<tr><td style='width: 120px'><a href='$row->link'>$row->website</a></td></tr>"; } echo"</table><br>"; } ?> Code (markup):
all i have to say at times like this... is do not use select *.... especially when asking questions regarding your output. pls2see http://parseerror.com/~pizza/select*isevil.html
for your replies and for the offered details to solve my problems, i really appreciate your help folks! im optimistic that im able to finish this with your offered help kind regards PHPDummy