
mySQL and PHP - Login and Registration - Saving Movie Clip ('s) Position - Page 3
Part II - Setting up the PHP
The PHP scripts will be better explained by reading the comments in the attached files. Just open up the PHP script with notepad or any other text editor to make changes.
The first thing we have to do is connect to the database. You will need to know your database name, account username, and database password. In order to keep this as simple as possible use an include file to list these variables - They will be the same for each one of your scripts. This is what is contained in the file Include.inc. One thing to note is that often times the $DBhost variable is slightly different then "localhost" - Sometimes it can be "localhost.yourHost.com".
$DBhost = "localhost"; $DBuser = "UserName"; $DBpass = "DatabasePassword"; $DBName = "DatabaseName"; $table = "saveMovie"; ?>
You will notice that at the top of each PHP script there is a line of code something like this: include ('Include.inc'); All this does is to include those variables in the script. It's just an easier way of keeping track of everything.
Next you want to make a connection to the Database:
mysql_connect($DBhost,$DBuser,$DBpass); @mysql_select_db("$DBName");
You can see how the variables in the Include File are used here. I'm only going to go over in detail the SQL query part of each script. The rest you should be able to figure out by reading through the comments in the File. Also note that for simplicity some basic sercurity precautions where left out. These are not necessary but you might want to include them if you have any type of sensitive data.
» Level Advanced |
Added: 2001-07-03 Rating: 8 Votes: 116 |
» Author |
No details available. |
» Download |
Download the files used in this tutorial. |
Download (74 kb) |
» Forums |
More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.
Comments
There are no comments yet. Be the first to comment!