Hi there
Completely stumped on the simplest of things...
Here is my PHP code:
<?php
//includes the connection parameters from external file
require_once('connection.php');
// Receive the variables
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$ip = gethostbyname($_SERVER['REMOTE_ADDR']);
// Establish connection with database
$connect = mysql_connect($hostname, $username, $password) or die("Could not connect to localhost");
// Select database
$select = mysql_select_db($database, $connect) or die("Could not find database.");
// Insert data to database
$sql = mysql_query("INSERT INTO tc_mailist ('fname', 'lname', 'email', 'ip') VALUES ('Joe', 'Bloggs', 'joe@bloggs.com', $ip)");
if(!$sql) {
die("Nope");
} else {
echo "1 record added";
}
mysql_close($connect);
?>
$sql step doesn't seem to work no matter how I change the formatting.
No literature I've read seems to help. Any ideas?
Thanks!