|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Can anyone help me change this PHP code into JSP:
<?php $con = mysql_connect('localhost', 'root', ''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("test", $con); $result = mysql_query("SELECT * FROM clubs"); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $clubid = $row['ClubID']; $clubname = $row['ClubName']; $clubmanager = $row['ClubManager']; echo "<div>"; echo "<a href=\"profile.php?cid={$clubid}&cn={$clubname}&cm ={$clubmanager}\">"; echo "{$clubname}"; echo "</a>"; echo "</div>"; } } ?> This is is the first page and then in the second page is: <?php function getID($string) { $con = mysql_connect('localhost', 'root', ''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("test", $con); $var = get_magic_quotes_gpc() ? stripslashes($string) : $string; return mysql_real_escape_string($var); } $cid = getID($_GET['cid']); $cn = getID($_GET['cn']); $cm = getID($_GET['cm']); $sql = "SELECT * FROM `clubs` WHERE `ClubID`='$cid' AND `ClubName`='$cn' AND `ClubManager`='$cm'"; $result = mysql_query($sql) OR DIE (mysql_error()); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { echo "<table border='1'> <tr> <th>Club Name</th> <th>Club Manager</th> <th>Club Stadium</th> <th>Club Sponsor</th> <th>Crest</th> </tr>"; echo "<tr>"; echo "<td>" . $row['ClubName'] . "</td>"; echo "<td>" . $row['ClubManager'] . "</td>"; echo "<td>" . $row['ClubStadium'] . "</td>"; echo "<td>" . $row['ClubSponser'] . "</td>"; echo "<td><img src=\"images/crest/" .$row['Crest'].".gif\"/></td>"; echo "</tr></table>"; echo "<table border = 1> <tr><td><b>About</b></td></tr> <tr><td width=\"664\">" . $row['Description'] . "</td></tr></table>"; } } else { echo "Houston? We have a problem."; } ?> Your help would be greatly appreciated Thanks a million Colm |
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP 5 and OOP | Jordan | PHP Tutorials | 11 | 09-22-2008 01:58 AM |
| PHP 4 end of life announcement | Jordan | Programming News | 4 | 08-30-2007 09:55 AM |
| Xav | ........ | 1322.18 |
| MeTh0Dz|Reb0rn | ........ | 1053.7 |
| morefood2001 | ........ | 879.43 |
| John | ........ | 877.37 |
| marwex89 | ........ | 869.98 |
| WingedPanther | ........ | 830.24 |
| Brandon W | ........ | 735.07 |
| chili5 | ........ | 309.39 |
| Steve.L | ........ | 236.23 |
| dcs | ........ | 216.02 |
Goal: 100,000 Posts
Complete: 82%