VeronMan Posted March 18, 2007 Share Posted March 18, 2007 Check it out here http://veron.orgfree.com/register.php Try to create a new account (activation thingy is member) and click submit, and then it takes you to a page which says: Table '107887.Users' doesn't exist 107887 is the name of my database, but what's wrong, do I have to create a table called Users in the database? Thanks for any help! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 18, 2007 Share Posted March 18, 2007 Please post your code between tags. Without it we can't tell you what your problem is. Ken Quote Link to comment Share on other sites More sharing options...
per1os Posted March 18, 2007 Share Posted March 18, 2007 Do you have to create a table called users, Of course if you are trying to insert or pull table from the users table. Read up on SQL bud, you have to have a table created with a structure before you can put anything into it/pull from it. Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 18, 2007 Author Share Posted March 18, 2007 How exactly do I create a table in MYSQL? Quote Link to comment Share on other sites More sharing options...
The Bat Posted March 18, 2007 Share Posted March 18, 2007 Just curious, how do you know PHP but not even the basics of MySQL/SQL? Read the MySQL docs and/or use a database management system such as phpMyAdmin. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted March 18, 2007 Share Posted March 18, 2007 not everyone learns mysql because they are learning php, it is just that most people now are using mysql instead of flat-file. VeronMan, i suggest you follow The Bat's suggestion on reading up on the mysql documentation, then if you have more trouble come back. search google for things like: create mysql table in php or something along those lines. Quote Link to comment Share on other sites More sharing options...
per1os Posted March 18, 2007 Share Posted March 18, 2007 www.wemonkey.com provides great tutorials for SQL PHP etc. I would go there to try up on SQL. Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 20, 2007 Author Share Posted March 20, 2007 Ok, after reading up on MYSQL and phpMyAdmin, I decided to use phpMyAdmin, simply because it's "easy" to use, and I have no real interest in learning MYSQL right now. So, I got into phpMyAdmin, created my database called 107887, and now I need to add tables to the database. How exactly do I do that? From my assumptions, you need to add a table for every value you want to store through the registration, so I would need a table called firstname, lastname, password, reppassword, email etc, etc. Is this correct? This is the phpMyAdmin Interface which I'm stuck on, so my question is? Is the above correct, and if so, how do I create tables, and know what values to enter into the fields in phpMyAdmin? Link to a screenshot included below of the phpMyAdmin interface of when I clicked "go" I named the table firstname as you can see, and selected the number of fields to be 1. Screenshot: http://img172.imageshack.us/img172/9559/phpmyadminshotbe8.jpg Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 20, 2007 Share Posted March 20, 2007 read this all ok http://www.reg.ca/faq/PhpMyAdminTutorial.html Quote Link to comment Share on other sites More sharing options...
DeathStar Posted March 20, 2007 Share Posted March 20, 2007 You can do it that way like in the screenshot but it takes lots of time. Oh and you do know phpmyadmin works with mysql commands? For quick lesson on mysql commands: http://www.pantz.org/database/mysql/mysqlcommands.shtml Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 24, 2007 Author Share Posted March 24, 2007 Okay, i've been using phpMyAdmin tirelessly now, and I think i'm almost there. Now, after trying to register, I get the error: Unknown columm 'code' in 'field list' The error appears after you enter your details and click Submit on the page at http://veron.sitesled.com/register.html What's the problem now? Here's the register.php script that i'm using, it might help you solve my problem: <? include 'config.php'; if(isset($_POST['submit'])) { $first = addslashes(trim($_POST['firstname'])); $surname = addslashes(trim($_POST['surname'])); $username = addslashes(trim($_POST['username'])); $email = addslashes(trim($_POST['email'])); $pass = addslashes(trim($_POST['password'])); $conf = addslashes(trim($_POST['confirm'])); $activ = addslashes(trim($_POST['activation'])); $date = date("d/m/y"); $errormsg='Errors:\n'; # pop up window if password is not equal to confirmed password if ( $_POST['password'] == $_POST['confirm'] ) {$error1=0;}else{ $error1=1; $errormsg=$errormsg.'Passwords were not the same\n'; #echo '<script>alert("Your passwords were not the same, please enter the same password in each field.");</script>'; #echo '<script>history.back(1);</script>'; #exit; } # encode the password $password = md5($pass); # pop up window if any field was left empty if ((((( empty($first) ) || ( empty($surname) ) || ( empty($username) ) || ( empty($email) ) || ( empty($password) ))))) { $error2=1; $errormsg=$errormsg.'One or more fields were left empty\n'; #echo '<script>alert("One or more fields was left empty, please try again.");</script>'; #echo '<script>history.back(1);</script>'; #exit; }else{$error2=0;} # pop up window if an invalid email address was entered if((!strstr($email , "@")) || (!strstr($email , "."))) { $error3=1; $errormsg=$errormsg.'Invalid email address\n'; #echo '<script>alert("You entered an invalid email address. Please try again.");</script>'; #echo '<script>history.back(1);</script>'; #exit; }else{$error3=0;} # check if username is already in use in the database and pop up if there is $q = mysql_query("SELECT * FROM Users WHERE Username = '$username'") or die(mysql_error()); if(mysql_num_rows($q) > 0) { $error4=1; $errormsg=$errormsg.'Username already in use\n'; #echo '<script>alert("The username you entered is already in use, please try again.");</script>'; #echo '<script>history.back(1);</script>'; #exit; }else{$error4=0;} # check if activation code is correct $q1 = mysql_query("SELECT code FROM codes WHERE id = 1") or die(mysql_error()); $q2 = mysql_query("SELECT code FROM codes WHERE id = 2") or die(mysql_error()); $row1 = mysql_fetch_array($q1); $row2 = mysql_fetch_array($q2); if ( $_POST['activation'] == $row1['code'] ){ $code = 0; $error5=0; }elseif ( $_POST['activation'] == $row2['code'] ){ $code = 9; $error5=0; }else { $error5=1; $errormsg=$errormsg.'Activation code incorrect\n'; #echo '<script>alert("Your activation code was incorrect, please enter the correct code to register.");</script>'; #echo '<script>history.back(1);</script>'; #exit; } if ($error1 || $error2 || $error3 || $error4 || $error5){ echo '<script>alert("'.$errormsg.'");</script>'; echo '<script>history.back(1);</script>'; exit; } $name = $first . ' ' . $surname; $query = mysql_query("INSERT INTO Users (Username, Password, Name, Email, Date, Level) VALUES ('$username','$password','$name','$email','$date','$code')") or die(mysql_error()); if($query) { echo ' <html> <head> <title>Success</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="success"> <p>Success! You are now a registered member</p> <p>Click <a href="login.php">here</a> to login</p> </div> </body> </html> '; } else { echo ' <html> <head> <title>Error</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="error"> <p>We are sorry, there appears to be a problem with our script at the moment.</p> <p>Your data was not lost. Username: '.$username.' | Password: '.$pass.' | Email: '.$email.' | Full name: '.$name.'</p> <p>Please try again by clicking <a href="login.php">here</a>.</p> </div> </body> </html> '; } } else { ?> <html> <head> <title>Register</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <div id="head">the registration page</div> <br> <div id="main"> <p>Welcome to the registration, fill out the form below and hit Submit. All fields are required,so fill them all out! </p> <form action="<?= $_SERVER['PHP_SELF'] ?>" method="post"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr class="firstRow"> <td width="50%">First name </td> <td width="50%"><input name="firstname" type="text" class="textBox" id="firstname"></td> </tr> <tr class="secondRow"> <td>Surname</td> <td><input name="surname" type="text" class="textBox" id="surname"></td> </tr> <tr class="firstRow"> <td>Email Address </td> <td><input name="email" type="text" class="textBox" id="email"></td> </tr> <tr class="secondRow"> <td>Username</td> <td><input name="username" type="text" class="textBox" id="username"></td> </tr> <tr class="firstRow"> <td>Password</td> <td><input name="password" type="password" class="textBox" id="password"></td> </tr> <tr class="secondRow"> <td>Confirm Password </td> <td><input name="confirm" type="password" class="textBox" id="confirm"></td> </tr> <tr class="firstRow"> <td>User Activation Code *</td> <td><input name="activation" type="password" class="textBox" id="activation"></td> </tr> <tr class="secondRow"> <td>Register</td> <td><input name="submit" type="submit" class="textBox" value="Submit"></td> </tr> <tr class="firstRow"> <td>* Activation codes assessed by your administrator</td> <td>If you are already registered click <a href="login.php">here</a> to login</td> </tr> </table> </form> </div> </div> </body> </html> <? } ?> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted March 24, 2007 Share Posted March 24, 2007 in the Table codes their should be a field called code But also their should be 2 entries.. with you created these manually was a sql file supplied ? # check if activation code is correct $q1 = mysql_query("SELECT code FROM codes WHERE id = 1") or die(mysql_error()); $q2 = mysql_query("SELECT code FROM codes WHERE id = 2") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 24, 2007 Author Share Posted March 24, 2007 Ok, what should the other two entries be? And yes, the PHP script was supplied to me. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted March 24, 2007 Share Posted March 24, 2007 the Entries i have no idea, mut have ID 1 and 2, i asked if you had and SQL file, sometimes developer dump the database setup to a SQL file you can just import into phpmyadmin and it does the work for you.. either that or a detailed doc.. Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 25, 2007 Author Share Posted March 25, 2007 Ah, no, I have no SQL file. There's no doc either. So now i've added a table called codes, and in that table there's a field called code. Now, i'm getting the error: Unknown column 'id' in 'where clause' What's the problem with this? :-\ Quote Link to comment Share on other sites More sharing options...
MadTechie Posted March 25, 2007 Share Posted March 25, 2007 need to add the field "id" in codes Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 25, 2007 Author Share Posted March 25, 2007 Done, but now i'm getting: Unknown column 'Name' in 'field list' What's wrong here? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted March 25, 2007 Share Posted March 25, 2007 oh boy.. you know i'll ask again were you supplied a SQL file ? Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 26, 2007 Author Share Posted March 26, 2007 No, sorry, I wasn't. Quote Link to comment Share on other sites More sharing options...
DeathStar Posted March 26, 2007 Share Posted March 26, 2007 Lol, check you're source first next time. Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 26, 2007 Author Share Posted March 26, 2007 Sorry about that DeathStar. Anyway, so, yeah, I'm getting this error now: Unknown column 'Name' in 'field list' How do I fix that up? Quote Link to comment Share on other sites More sharing options...
DeathStar Posted March 26, 2007 Share Posted March 26, 2007 Does the field "Name" exists && Is it in the table you are connecting to? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted March 27, 2007 Share Posted March 27, 2007 OK Unknown column 'Names' in 'field list' if you get this error again then check the table for a field by that name, as you asked when it said ID Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 27, 2007 Author Share Posted March 27, 2007 I'm still getting the error after messing around with the database a bit, so what exactly do I need to do? Add the field Names to the Users table? Create a table called Names? I'm really confused. ??? Quote Link to comment Share on other sites More sharing options...
VeronMan Posted March 28, 2007 Author Share Posted March 28, 2007 *Bump* Can anybody help with the current error message i'm recieving? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.