Im haveing a problem with this code:
<?php
include 'connect.php';
$SQL = "INSERT into users(username, password, email,)
VALUES ('dado','123','neki@gmail.com',)";
mysql_query($SQL) or die("could not register");
?>
My connect.php looks like this:
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'igra';
?>
When I try to exectue it, Im getting error. Tryed testing connection with
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'igra';
$connect = mysql_connect($dbhost, $dbuser, $dbpass)
or die("Unable to connect to dbhost");
mysql_select_db($dbname)
or die("Could not connect to db");
$test_query = "SHOW TABLES FROM $dbname";
$result = mysql_query($test_query);
$tblCnt = 0;
while($tbl = mysql_fetch_array($result)) {
$tblCnt++;
#echo $tbl[0]."<br />\n";
}
if (!$tblCnt){
echo "There are no tables<br />\n";
} else {
echo "There are $tblCnt tables<br />\n";
}
?>
and it return msg: There are 4 tables. Which means connect.php is properly set. Now I tryed to run code into MySQL Admin program itself with "INSERT into" query, and it worked. So, everything seems to work fine separatly, but when put together, it wont work. Can somebody point me to misstake Im makeing please?