|
||||||
| 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 | 10 | 08-22-2008 05:37 AM |
| PHP 4 end of life announcement | Jordan | Programming News | 4 | 08-30-2007 09:55 AM |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| LogicKills | ........ | 20.00000 |
| sam | ........ | 20.00000 |
| gaylo565 | ........ | 18.00000 |
| |pH| | ........ | 15.00000 |
| WingedPanther | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 67%