View Full Version : Match Result Add Script - Help :)

02-17-2006, 04:19 PM
Hi, im writing a script for match result adding for my clan to make it easier for us rather than editing the page each time we play :)

Im pretty new to using php+sql, so i dont really know how i would display the results in a table after adding them to a database.

This is what i currently have:


$dbh=mysql_connect ("mysql93.secureserver.net", "deansdatabase", "********") or die ('I cannot connect to the

database because: ' . mysql_error());
mysql_select_db ("deansdatabase");

The Form:

<title>Add a Result</title>
<link rel="stylesheet" type="text/css"
<form name="add" action="form.php" method="POST">
Match Type: <select name="type">
<option value="Enemy Down Official">Enemy Down Official</option>
<option value="Enemy Down Friendly">Enemy Down Friendly</option>
<option value="Scrim">Scrim</option>
</select><br /><br />
Clan Name: <input type="text" name="cname"><br /><br />
Result: <select name="result">
<option value="Win">Win</option>
<option value="Loss">Loss</option>
<option value="Draw">Draw</option>
</select><br /><br />
Score: <input type="text" name="sens" value="6senseuK"> -VS- <input type="text" name="clan" value="Other Clan"><br /><br />
Map: <select name="map">
<option value="de_dust2">de_dust2</option>
<option value="de_train">de_train</option>
<option value="de_dust">de_dust</option>
<option value="de_aztec">de_aztec</option>
<option value="de_inferno">de_inferno</option>
<option value="cs_italy">cs_italy</option>
<option value="cs_office">cs_office</option>
<option value="de_prodigy">de_prodigy</option>
<option value="de_cbble">de_cbble</option>
<option value="de_port">de_port</option>
<option value="de_clan_mill">de_clan_mill</option>
<option value="de_contra">de_contra</option>
<option value="de_cpl_fire">de_cpl_fire</option>
<option value="de_blast_ed">de_blast_ed</option>
</select><br /><br />
Screenshot 1st Half: <input type="text" name="ss" value="Screenshot URL"><br /><br />
Screenshot 2nd Half: <input type="text" name="ss2" value="Screenshot URL"><br /><br />
<input type="submit" value="Add Result!"> <input type="reset" value="Reset Form!">



foreach($_POST as $key => $val) {
$_POST[$key] = htmlspecialchars($val, ENT_QUOTES);
$a = date("G:i:S ");
$b = date("d M");
$time = "$b at $a";
$ip = $_SERVER

$score=$_POST["sens, clan"];

mysql_query("INSERT INTO `$mysql_table` (type,cname,result,score,map,ss,sss) VALUES

if(mysql_error()) {

Result Added

Now this should be all right afaik, but how would i display the results in a table from the database?

Any help greatly appreciated!

02-17-2006, 04:33 PM

I prefer the mysql_fetch_assoc method.

02-17-2006, 06:26 PM
What would be an example code using that way, to display it in a table?

02-21-2006, 03:50 PM
The example shows you how to connect to the database and output the query in a table.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum