Hi,
I’ll give as much detail as I can as I’m aware different servers respond in different ways.
I’m trying to learn how to build a PHP form which will write to a SQL database. My host is currently www.1and1.co.uk (though the SQL server carries a .com address).
I am using Webmatrix 2 to write the code, filezilla to upload to the FTP site and I upload the file to my 1and1.co.uk address.
Whenever I upload it will always load any text I put in my file in normal HTML but it won’t even recognize a hello world example like
[php]<? PHP
Print “Hello World”;
?>
[/php]
The code below is blanked as much as is needed to hide the log ins but no other changes have been made to the code. This includes the comments which I tried toying about with to see if I could get it to do some work for me!
[php]<?php
//ini_set(‘display_errors’,1);
//error_reporting(E_ALL);
//echo(“Starter for 10”);
$con = mysql_connect(“db4278xxxxx.db.1and1.com”, “dbo4278xxxxx”,“password used when setting up SQL database in 1and1 database”);
print “Connection”;
if (!$con){
die('Could not connect: '.mysql_error());
}
// print “If statement”;
mysql_select_db(“Logins”, $con);
// print “select db”;
$sql = ‘INSERT INTO Logins (Client_ID, Username, Password) VALUES (7, “Internet”, “Helper”)’;
mysql_query($sql);
mysql_close($con);
?>[/php]
the username, hostname and password are all specific to the SQL database and not the log in to the 1and1 admin account.
Any and all help would be amazing!
Thanks
Maudise