I am getting a syntax error after I added another value to be added to the data base. I have no idea what is the problem I'm kinda new to php and mysql. what am i doing wrong?
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 ''index',name,score) VALUES ('2','guyaa','300')' at line 1
this is the insert php:
<?php
require_once 'app_config.php';
connect();
$index = $_GET['index'];
$name = $_GET['name'];
$score = $_GET['score'];
$query = "INSERT INTO scores (index,name,score) VALUES ('" . $index ."','" . $name ."','" . $score . "')";
$result = mysql_query($query) or die('ERROR: '. mysql_error());
and this is the retrieve :
<?php
require_once 'app_config.php';
connect();
$query = "SELECT * From scores";
$result = mysql_query($query);
while($item = mysql_fetch_array($result)){
echo $item['index'];
echo ' - ';
echo $item['name'];
echo ' - ';
echo $item['score'];
echo '<br>';
}