Jump to content

[SOLVED] I don't understand why I have this error....


icez

Recommended Posts

Hey,

On my page, I have this error :

 

Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match ORDER BY id' at line 1

 

And  I have no clue why I have this error...

 

My code :


<?php
} if($page == match){

echo "<br /><br />";

$query = "SELECT id, match, date FROM match ORDER BY id";
$result = mysql_query($query) or die('Error : ' . mysql_error());
?>
<table width="600" border="0" cellpadding="5" cellspacing="1" bgcolor="#BBD9EE">
<tr align="center" bgcolor="#BBD9EE">
<td width="500"><strong>Clan - Date</strong></td>
<td width="150"><strong>Action</strong></td>
</tr>
<?php
while(list($id, $match, $date) = mysql_fetch_array($result, MYSQL_NUM))
{

?>
<tr bgcolor="#FFFFFF">
<td width="500">
<?php echo $match;?> - <?php echo $date;?>
</td>
<td width="150" align="center"> <a href="javascript:delMatch('<?php echo $id;?>','<?php echo $match;?>');">delete</a> </td>
</tr>
<?php
}
?>
</table>
<?php
if(isset($_POST['save77']))
{
   $match      = $_POST['match'];
   $date      = $_POST['date'];
   
   $query = " INSERT INTO match (match, date) ".
            " VALUES ('$match', '$date')";
   mysql_query($query) or die('Error ,query failed');

   echo '<b><font color=\"red\">Future Match Ajouter.</b></font><br /><a href="admin.php?page=match">Retour</a><br /><br />';
}

?>
<form method="post">
<table width="700" border="0" cellpadding="2" cellspacing="1">
<tr>
<td width="100"><b>Match :</b></td>
<td><input name="match" type="text"></td>
</tr>
<tr>
<td width="100"><b>Date :</b></td>
<td><input name="date" type="text"></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="save77" type="submit" value="Envoyer"></td>
</tr>
</table>
</form>

 

And Mysql table :

 


CREATE TABLE `match` (
  `id` int(11) NOT NULL auto_increment,
  `match` varchar(50) NOT NULL,
  `date` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`)
) 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.