Database Schema:
CREATE TABLE `db1`.`info`
(
`Name` NOT NULL,
`PhoneNumber` INT(15) NOT NULL,
`Location` NOT NULL,
`Var1` LONGTEXT NOT NULL,
`Var2` LONGTEXT NOT NULL
) ENGINE = InnoDB;
connection.php:
$con = new mysqli("localhost","root","","db1") or die ("Conn Error");
index.php:
<?php
include_once("connection.php");
$name="New Person";
$phone="0121234567";
$loc="New York";
$var1="A";
$var2="B";
$insert="INSERT INTO info (Name, PhoneNumber, Location, Var1, Var2) VALUES ('$name','$phone','$loc','$var1','$var2')";
$result1 = $con->query($insert);
?>
I've just started to learn php and when I tried to do this (after the connection was created) and I was not getting any output. -EDIT- By output I mean it isn't getting added to the database.
So I looked around and found
if(!$result1){ //error-checking
var_dump($result1);
and added it before ?> and the output I'm getting is bool(false). Why is that? And also, how do I correctly insert values into my table?
Thanks in advance.