David_Nich
Junior Member
- Nov 2, 2012
- 133
- 72
Hi,
I just can't see what's wrong when i try to insert data from my website admin into my database:
I don't get any error, but the data is not added into the events table.
if anyone could help would be great
I just can't see what's wrong when i try to insert data from my website admin into my database:
Code:
<?php
if(!isset($_POST["submit"]))
{
$content = "<form method='post' action=''><table border='0' cellspacing='5' cellpadding='0'>
<tr><td>Equipa 1:</td><td><input type='text' name='hometeam' size='30' /></td></tr>
<tr><td>Equipa 2:</td><td><input type='text' name='awayteam' size='30' /></td></tr>
<tr><td>Odd equipa 1:</td><td><input type='text' name='ratiohome' size='30' /></td></tr>
<tr><td>Odd equipa 2:</td><td><input type='text' name='ratioaway' size='30' /></td></tr>
<tr><td>Odd empate:</td><td><input type='text' name='ratiox' size='30' /></td></tr>
<tr><td>ID jogo:</td><td><input type='text' name='sportid' size='30' /></td></tr>
<tr><td>NADA:</td><td><input type='text' name='played' size='30' /></td></tr>
<tr><td>Hora:</td><td><input type='text' name='starttime' size='30' /></td></tr>
<tr><td>NADA:</td><td><input type='text' name='winner' size='30' /></td></tr>
<tr><td>NADA:</td><td><input type='text' name='totalbets' size='30' /></td></tr>
<tr><td></td><td><input type='submit' name='submit' value='Enviar' /></td></tr>
</table></form>";
}
else
{
if(!empty($_POST["hometeam"]) && !empty($_POST["awayteam"]) && !empty($_POST["ratiohome"]) && !empty($_POST["ratioaway"]) && !empty($_POST["ratiox"]) && !empty($_POST["sportid"]) && !empty($_POST["played"]) && !empty($_POST["starttime"]) && !empty($_POST["winner"]) && !empty($_POST["totalbets"]))
{
$hometeam = $_POST["hometeam"];
$awayteam = $_POST["awayteam"];
$ratiohome = $_POST["ratiohome"];
$ratioaway = $_POST["ratioaway"];
$ratiox = $_POST["ratiox"];
$sportid = $_POST["sportid"];
$played = $_POST["played"];
$starttime = $_POST["starttime"];
$winner = $_POST["winner"];
$totalbets = $_POST["totalbets"];
$sql = "INSERT INTO `events` (`hometeam`, `awayteam`, `ratiohome`, `ratioaway`, `ratiox`, `sportid`, `played`, `starttime`, `winner`, `totalbets`) VALUES('$hometeam', '$awayteam', '$ratiohome', '$ratioaway', '$ratiox', '$sportid', '$played', '$starttime', '$winner', '$totalbets')";
$res = mysql_query($sql) or die();
print("<meta http-equiv='refresh' content='0;URL=admin.php?page=add_bettings' />");
}
else
{
$template->assign("content", "Texto qql!");
}
}
?>
I don't get any error, but the data is not added into the events table.
if anyone could help would be great
Last edited: