Forum Moderators: coopster

Message Too Old, No Replies

Pulling from server database.

         

VegasAddy

2:47 am on Feb 1, 2011 (gmt 0)

10+ Year Member



Ill do my best to explain. Ive searched google and searched this forums among others but have not found a solid answer or how to. Thanks so much for the help.

I have a form that takes the following information:
**STATS**
Name
Nick Name
Record
Wins
BIO
PhotoLink
.

I have a second form that takes in new events.
**Events Results**
Result
Opponent
Method
Event title
Date
Round
Time

.

The results are saved on mysql server

I want people to be able to go to my site and be able to search by opponent name. the search will display the following:


**STATS**

photo


Advertisement

BIO


**Event Stats** sorted by date



I have the form completed and pretty much need help with the rest.

I am using Lime Survey to create the forms.

I included the image below of the layout.

Thanks in advanced. I would love to be pointed in the right direction. I have lots and lots of manuals that apply to this but Am having alot of difficulty understanding what is what.


http://img137.imageshack.us/img137/9581/fighterspro.th.jpg [/IMG] [img137.imageshack.us]

Uploaded with ImageShack.us [imageshack.us]

rocknbil

6:39 pm on Feb 1, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Start with a form:

<form method="post" action="get-opponent.php">
<p><label for="opponent">Enter Opponent Nickname:</label><input type="text" name="opponent" id="opponent" value=""></p>
<p><input type="submit" value="Submit"></p>
</form>

get-opponent will contain (roughly):


// Make your database connection - see manual
$results = null;
$query = "select `Name`,`PhotoLink`,`BIO` from `STATS` where `Nick Name` = '" . mysql_real_scape_string(strip_tags($_POST['opponent'])) . "'";
$result = mysql_query($query) or die("Cannot query stats: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
$results .="
<img style=\"float: left;\" src=\"" . $row['PhotoLink'] . "\" alt=\"" . $row['Name'] . "\">
<p>Name: " . $row['Name'] . "</p>
<p>" . $row['BIO'] . "</p>
";
}
if ($results) {
echo "
<h1>Player Stats</h1>
$results
";
}
else { echo "<p>No results were found</p>"; }
//
echo "<h2>Events</h2>";
//
$results = null; // reset
$query = "select * from `event results` order by `Date` desc";
$result = mysql_query($query) or die("Cannot query events: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
$results .="
<tr>
<td>" . $row['Result'] . "</td>
<td>" . $row['Opponent'] . "</td>
<td>" . $row['Event title'] . "</td>
<td>" . $row['Round'] . "</td>
<td>" . $row['Date'] . "</td>
<td>" . $row['Time'] . "</td>
</tr>
";
}
if ($results) {
echo "
<table>
<tr>
<th>Result</th>
<th>Opponent</th>
<th>Event title</th>
<th>Round</th>
<th>Date</th>
<th>Time</th>
</tr>
$results
</table>
";
}
else { echo "<p>No events were found.</p>"; }


NOT WORKING CODE and will need some study up on your part, but this is a working framework to get you started.