Hi, I am very new to PHP, teaching myself at the moment. I am using online tutorials to teach myself, so I am at their mercy of what information they provide. I have found some decent scripts, but they don't show me how to link them together.
I am trying to teach myself how to make a database using PHP and MySQL. I have a server that is hosting the website I am going to try to use this on. The server claims that it supports PHP and MySQL. I using some very basic script that I found on some tutorials in order to start using it, to get a better understanding of how it works. I don't know if this makes any difference, but I am currently using Dreamweaver MX 2004 to write my code in, and to upload to the server. My first script that I tried to upload was a 'create database' script. I uploaded it to the server and then tried to open the file, and I received this error message:
'Parse error: parse error in /var/www/html/db/create_befit_database.php on line 20'
I haven't been able to find what a parse error means. I will attempt to include the script that I used, but this is my first time, so forgive me if I mess it up. I obviously took out the actual data from the host/username/password for security reasons, but it is there in the script that I uploaded into the server. Line 20 appears to me to be the closing html tag. This seems to be such a basic script that it is frustrating that I am already getting an error. I did notice that when I was inputing the connect information, dreamweaver had a pop up suggesting how to finish the code I started writing, and it was a little different then the code the tutorials had used. The tutorials had used quotes around the host/username/password names, but dreamweaver seemed to suggest using brackets, and they suggested inputing the ftp folder name. Sorry if this is just rambling, but I'm trying to include as much details as possible. Thanks in advance for any input in this. Here is my attempt at including the script.
<html>
<body>
<?php
$con = mysql_connect("Host", "username", "password"
);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}// Create database
if (mysql_query("CREATE DATABASE testhouses_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
?>
</body>
</html>