Error:
parse error line 8 not expecting ','
I just don't see it, maybe been in front of this PC too long:
$dbc = mysql_connect('localhost', 'xxxx', 'xxxxxx', 'xxxxxxx')
or die('error connecting');
$addcontact = "INSERT INTO `user`(`ID`, `Name`, `Comments`, `GPS String`, `IP Address`)".
"VALUES('100003','john','blah','xxxxxxx','192.168.5.5')";
$result = ($dbc, $addcontact)
or die('error querying');
echo("contact added");
mysql_close ($dbc);
I think you forgot the function name here:
$result = ($dbc, $addcontact) or die('error querying');
Something like...
$result = mysql_query($dbc, $addcontact) or die('error querying');
... would probably work.
Even better would be (as suggested by @Chitowns24) to use MySQLi, which means you should use mysqli_connect
and mysqli_query
for those functions.
Are you are trying to specify a database in your connection string? You can do that with mysqli
, but not with mysql
.
mysqli_connect('localhost', 'xxxx', 'xxxxxx', 'database');
Assuming you want to continue using mysql and not mysqli:
<?php
$db = mysql_connect('host', 'username', 'password');
mysql_select_db('database', $db);
// Go on with your querying and such...
?>