Im trying to connect to a database from php. Heres the code:
<?php
$dbc = mysqli_connect('192.168.0.122', 'boyyo', 'KiaNNa11', 'aliendatabase')
or die('Error connecting to MySQL server.');
$query = "INSERT INTO aliens_abduction (first_name, last_name, " .
"when_it_happened, how_long, how_many, alien_description, " .
"what_they_did, fang_spotted, other, email) " .
"VALUES ('Sally', 'Jones', '3 days ago', '1 day', 'four', " .
"green with six tentacles', 'We just talked and played with a dog', " .
"'yes', 'I may have seen your dog. Contact me.', " .
"'sally@gregs-list.net')";
$result = mysqli_query($dbc, $query)
or die('Error querying database.');
?>
I think i have a theory that my MySQL server location is wrong but i dont know. I use HostGator to do this and im using Phpmyadmin. But everytime i type in a form that i created it says Error querying database. Can someone tell me whats wrong with this code. Oh by the way im using head first into PHP and MySQL