Hi everyone, I just started learning php like last week and tried typing out my first ever piece of code involving MySQL (I've done HTML before) and though it's such a simple code, I can't seem to find the problem. I've already included all the error reporting stuff but when I try to run this piece of code nothing comes up and nothing appears in my MySQL databases when I try the SELECT query.
Code: Select all
<html>
<body>
<?php
error_reporting(E_ALL);
$host = "localhost";
$user = "root";
$password = "password";
$db = "test";
$cxn = mysqli_connect($host,$user,$password,$db) or die(mysql_error());
$sql = "insert into posts (Title,Content) values ("test","test")";
$result = mysqli_query($cxn,$sql) or die(mysql_error());
var_dump($result);
?>
</body>
</html>
I'm sorry to bother everyone with such simple code, but I've been fretting over nothing but this for the past few hours and really need someone to advise me.
Thanks in advance.