Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Java Help

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

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.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-07-2008, 09:21 AM
clarky08 clarky08 is offline
Newbie
 
Join Date: Apr 2008
Posts: 1
Credits: 0
Rep Power: 0
clarky08 is on a distinguished road
Default Php Jsp!!

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -5. The time now is 08:19 PM.

Contest Stats

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

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 82%

Ads