CODE
<?php
error_reporting(E_ALL);
include("********");
$connect = mysqli_connect($host,$account,$password);
$db = mysqli_select_db($connect,$dbname);
$testa = 3;
$testb = 7;
$sql = "INSERT INTO testTable (testa,testb) VALUES ($testa,$testb)";
$result = mysqli_query($sql);
mysql_close($connect);
?>
error_reporting(E_ALL);
include("********");
$connect = mysqli_connect($host,$account,$password);
$db = mysqli_select_db($connect,$dbname);
$testa = 3;
$testb = 7;
$sql = "INSERT INTO testTable (testa,testb) VALUES ($testa,$testb)";
$result = mysqli_query($sql);
mysql_close($connect);
?>
I'm sure, because of tests I put in place, that it's connecting to the server and the database successfully, but it won't insert the information. To prove it, here's the file with the tests in place and the code for it:
http://mechhelp.net/database/
Spoiler: Click to Toggle the Spoiler.
CODE
<?php
error_reporting(E_ALL);
include("********");
$connect = mysqli_connect($host,$account,$password);
if ($connect) {
echo "Connected to server<br>";
} else {
echo "Server connection error<br>";
}
$db = mysqli_select_db($connect,$dbname);
if ($db) {
echo "Connected to database<br>";
} else {
echo "Database connection error<br>";
}
$testa = 3;
$testb = 7;
$sql = "INSERT INTO testTable (testa,testb) VALUES ($testa,$testb)";
$result = mysqli_query($sql);
if ($result) {
echo "Insert successful";
} else {
echo "Insert error";
}
mysql_close($connect);
?>
error_reporting(E_ALL);
include("********");
$connect = mysqli_connect($host,$account,$password);
if ($connect) {
echo "Connected to server<br>";
} else {
echo "Server connection error<br>";
}
$db = mysqli_select_db($connect,$dbname);
if ($db) {
echo "Connected to database<br>";
} else {
echo "Database connection error<br>";
}
$testa = 3;
$testb = 7;
$sql = "INSERT INTO testTable (testa,testb) VALUES ($testa,$testb)";
$result = mysqli_query($sql);
if ($result) {
echo "Insert successful";
} else {
echo "Insert error";
}
mysql_close($connect);
?>
[Close]