| tyler.watkins |
Apr 10 2012, 03:24 PM
Post
#1
|
|
Novice ![]() ![]() Group: Members Posts: 27 Joined: 6-March 12 Member No.: 16,654 |
<?php
$mysql_host = "********"; $mysql_database = "********"; $mysql_user = "*************"; $mysql_password = "*********"; $fname=$_POST['fname']; $lname=$_POST['lname']; $user=$_POST['username']; $password=$_POST['password']; $verify=$_POST['verify']; $email=$_POST['email']; $country=$_POST['country']; $month=$_POST['month']; $day=$_POST['day']; $year=$_POST['year']; $con = mysql_connect( $mysql_host, $mysql_user, $mysql_password ); if ( !$con ) { die( 'Could not connect: ' . mysql_error() ); } mysql_select_db( "$mysql_database",$con ); $table = "CREATE TABLE `$user` ( `fname` varchar(30), `lname` varchar(30), `username` varchar(30), `password` varchar(30), `email' varchar(30), 'country' varchar(30), 'month' varchar(30), 'day' int(2), 'year' int(4), PRIMARY KEY '$user' )" ; echo "Table Created!"; mysql_query($table,$con) or die (mysql_error()); mysql_close($con); ?> Above is my php code. I am trying to make a login system. I keep getting this error message "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7" I have no idea what this means because i have no code on line 7. Any help is greatly appreciated. Also if you have any suggestions, please pm me. The form for this php code is on the page "http://blocks.netne.net/register.html " Please visit and give me any suggestions as to what to do! Thanks! |
![]() ![]() |
| tyler.watkins |
Apr 11 2012, 11:50 PM
Post
#2
|
|
Novice ![]() ![]() Group: Members Posts: 27 Joined: 6-March 12 Member No.: 16,654 |
You lost me?
|
| Ephraim F. Moya |
Apr 12 2012, 12:02 AM
Post
#3
|
|
Advanced Member ![]() ![]() ![]() ![]() Group: Members Posts: 165 Joined: 2-September 07 From: New Mexico Member No.: 3,702 |
You lost me? first you select the database using the database's name. In this case the database name is database. Next you use a sql query to select the data you want. mysql_query( SELECT * FROM `table2` FOR `id` = 7 ); In English: give me all (*) the data for the row with id = 7. What you'll get back is an array with all the data in row 7 or you'll get back a false if there's no row 7. Study the diagram I posted. It describes a simple database like I think you want. This post has been edited by Ephraim F. Moya: Apr 12 2012, 12:06 AM -------------------- Ephraim F. Moya
"Los pintos y los pendejos Se conocen desde lejos." |
tyler.watkins You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7 Apr 10 2012, 03:24 PM
Ephraim F. Moya
<?php
$mysql_host = "********";... Apr 10 2012, 08:46 PM
Brian Chandler
I'm pretty sure that the MySQL error message... Apr 11 2012, 07:28 AM
tyler.watkins What would I do if I wanted to create a table with... Apr 11 2012, 08:11 AM
Brian Chandler
If you think you want to do this, you have almos... Apr 11 2012, 09:02 AM
tyler.watkins So I would make a table called users and everyone... Apr 11 2012, 10:07 AM
Brian Chandler
Yes. (This really should be in Chapter 1 of the ... Apr 11 2012, 10:38 AM
Ephraim F. Moya
Yes. (This really should be in Chapter 1 of the... Apr 11 2012, 11:45 AM
tyler.watkins What book? Apr 11 2012, 02:03 PM
Brian Chandler Whichever book you're using. (I suppose it mig... Apr 11 2012, 02:07 PM
tyler.watkins But if I make a table for all the users wouldn... Apr 11 2012, 02:12 PM
Darin McGrew Yes. That's the point.
Don't look for an ... Apr 11 2012, 05:26 PM
tyler.watkins I'm sorry for all the probably amateurish ques... Apr 11 2012, 05:39 PM
Ephraim F. Moya
+----------+ . . . . . . . .+--------+
| ... Apr 11 2012, 11:15 PM
tyler.watkins Thanks! Apr 12 2012, 05:38 AM
Ephraim F. Moya
Thanks!
I made a mistake in the query strin... Apr 12 2012, 10:51 AM
Christian J I moved one post to its own thread: http://forums.... Aug 31 2012, 09:08 AM
mde27 Please help! I'm having the same problem..... Apr 20 2013, 08:31 PM![]() ![]() |
|
Lo-Fi Version | Time is now: 19th June 2013 - 06:25 AM |