SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Dec 2, 2004, 21:25 #1
- Join Date
- Dec 2004
- Location
- Chicago, IL
- Posts
- 4
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Newbie: Populating A Single Table
Hi all. First time posting here, and I quite new to PHP. I am trying to simply add variables that I am receiving from a Flash form using the GET method. The variables are pointed to registration.php. They are being sent, because I can see them in the url, but the table doesn't seem to actually get updated, even thought I get the echo message about the update working
Any thoughts?
<html>
<title> THIS IS THE SCORE STORE TEST PAGE!</title>
<body>
<?php
$connect = mysql_connect("localhost","tletopgh_mclite", "0745599") or
die ("There was a problem connecting to MYSQL!");
mysql_select_db ("vecmxcco_people");
$sql="INSERT INTO login
(record, name_first, name_last, email, usrname, password)
VALUES (1, '$firstname', '$lastname', '$email', '$usrname', '$pass')";
echo "New data entered successfully!";
?>
</body>
</html>
Thanks for your time!
-
Dec 2, 2004, 21:49 #2
- Join Date
- Sep 2002
- Location
- Canada
- Posts
- 2,087
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
You have to actually grab the data from the super globar GET first. So do something like:
PHP Code:<html>
<title> THIS IS THE SCORE STORE TEST PAGE!</title>
<body>
<?php
$connect = mysql_connect("localhost","tletopgh_mclite", "0745599") or
die ("There was a problem connecting to MYSQL!");
mysql_select_db ("vecmxcco_people");
$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
$email = $_GET['email'];
$usrname = $_GET['usrname'];
$pass = $_GET['pass'];
$sql="INSERT INTO login
(record, name_first, name_last, email, usrname, password)
VALUES (1, '$firstname', '$lastname', '$email', '$usrname', '$pass')";
echo "New data entered successfully!";
?>
</body>
</html>"A nerd who gets contacts
and a trendy hair cut is still a nerd"
- Stephen Colbert on Apple Users
-
Dec 2, 2004, 22:46 #3
- Join Date
- Dec 2004
- Location
- Chicago, IL
- Posts
- 4
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for the quick response! I tried the altered code, but to no avail. . .I wonder what the problem is? I actually wrote another test script to ensure that the variables are being sent, and they definitely are. I am using phpmyadmin to create the table. . .Do I need to export the table somewhere in a particular format for it to be available for population?
-
Dec 3, 2004, 00:24 #4
- Join Date
- May 2004
- Location
- Braga, Portugal
- Posts
- 596
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Double check everything:
- See that the user has access to the table;
- Check if you have entered any data onto the table already;
- Also is the field `record` a key/primary? If it is just replace the 1 on the VALUES () statemente for '' or simple remove that first field.
Hope that helps~ Daniel Macedo
Bookmarks