Hi all...
I'm very new to PHP/MySql and I'm trying to solve my problem:
I have a table name risultati1 (results) with the following fields:
id_match
week
id_c (id of the team playing home)
id_f (id of the team playing away)
g_c (points scored by the home team)
g_f (points scored by the away team)
every week I have 4 matches and I would like to update all the results together without doing it separately...
this is the form I have created with a FIX week for trying purposal (it will become a variable)
PHP Code:
<?
include("dbinfo.inc.php" );
$db = mysql_connect("localhost", "$dbuser", "" ) or die("Problem connecting" );
mysql_select_db("$dbname",$db)or die("Problem selecting database" );
$result = mysql_query("SELECT * FROM risultati1 WHERE week='24'",$db);
echo "<table width='100%' border='1' cellpadding='0' cellspacing='0' bordercolor='#9999CC' class='risultati' background='Images/prova2.jpg'>\n";
echo "<tr bgcolor='#99CCFF'>\n";
echo "<td colspan='4'><div align='center'><strong><font color='#000000' face='Arial, Helvetica, sans-serif'>Risultati</font></strong></div></td>\n";
while($myrow = mysql_fetch_array($result))
{
$id_match = $myrow["id_match"];
$week = $myrow["week"];
$id_c = $myrow["id_c"];
$id_f = $myrow["id_f"];
$g_c = $myrow["g_c"];
$g_f = $myrow["g_f"];
echo "<FORM METHOD=GET ACTION=\"ins_risultati.php\">";
include("risultati.inc.php" );
echo "<tr bordercolor='#9999CC'>\n";
echo "<td width='35%' height='40' align='center'><font class='risultatitabebold'>$id_c</font></td>\n";
echo "<td width='35% height='40' align='center'><font class='risultatitabebold'>$id_f</font></td>\n";
echo "<td width='15%' height='40' align='center'><INPUT TYPE=\"TEXT\" NAME=\"g_c\" VALUE=\"$g_c\" SIZE=\"4\"></td>\n";
echo "<td width='15%' height='40' align='center'><INPUT TYPE=\"TEXT\" NAME=\"g_c\" VALUE=\"$g_f\" SIZE=\"4\"></td>\n";
}
echo "</TABLE>\n";
$id_c=(urlencode($id_c));
$id_f=(urlencode($id_f));
echo "<INPUT TYPE=\"HIDDEN\" NAME=\"id_match\" VALUE=$id_match>";
echo "<INPUT TYPE=\"HIDDEN\" NAME=\"id_c\" VALUE=$id_c>";
echo "<INPUT TYPE=\"HIDDEN\" NAME=\"id_f\" VALUE=$id_f><BR>";
echo "<INPUT TYPE=SUBMIT VALUE=\"Inserisci i risultati\">";
?>
and this is the ins_risultati.php file
PHP Code:
<?
include("dbinfo.inc.php" );
$db = mysql_connect("localhost", "$dbuser", "" ) or die("Problem connecting" );
mysql_select_db("$dbname",$db)or die("Problem selecting database" );
$id_c=(urldecode($id_c));
$id_f=(urldecode($id_f));
$sql="UPDATE risultati1 SET g_c='$g_c', g_f='$g_f' WHERE id_match='$id_match'";
?>
obviously 

it is not inserting the results and if I look at the URL I see only the last match team names and only the g_c variable for 8 times



pls HELP ME !!!!!!!!!!!!!!!!!!!!!
Roberto AKA Boboli
Bookmarks