Search the Community
Showing results for tags 'php access to database'.
-
Last week I purchased Mr. Ullman's "PHP and MySQL for Dynamic Web Sites" 4 edition. I have never tried working with php, nor mysql before. From my home, I have a stand-alone computer acting as a server. I am running Microsoft 2008 server on this computer. I also have Apache 2.2 running with no problems. I have installed "MySQL 5.6, and PHP 5.3.27, and again, no problems. I have a static ip address, and am hosting a small experimental website. I made the site with Dreamweaver. Wanting to try some script, I skipped ahead to Chapter 5, and experimented with some of the script. Using the "MYSQL Command line" lessons, I created a Database named "Bfdata." I then created a Table named "Members," with only two columns. The first column is named "username," and the second column is named "password." I then inserted 3 different users with the name of 1, 2, and 3 (those are the actual names I created for experimental sake) I gave each a password of xyzzyx123321 (that's the actual password for each one I created, also for experimental sake) I then went ahead to Chapter 9, and tried out the script 9.2 called "mysqli_connect.php" Try as I may, I couldn't get the file to communicate with the "mysql server." According to Mr. Ullman's tips, my php version might not support the "mysqli" function. So I searched the web and found a configuration that works good. The script reads as follows: <?php $link = mysql_connect('localhost' ,'john' , 'xyzzyx'); if (!$link) { die('could not connect: ' . mysql_error()); } echo 'connected successfully'; ?> My question is this: Obviously with the above script, I'm connecting to the Mysql server, but what I want the script to do, is not only successfully connect, but to then access the table called "members," and check for the "username" called 1 and check 1's password which is "xyzzyx123321," or "username 2, or 3 which also have the same password. Once the user name and password are successful , I'd like the script to pass the successful user on to a html page called upload that I made. Would someone write that script and either post it, or send it to my johninbellingham@hotmail.com email address. Thank you much, johnjwe