hey peepz i have a problem. ok so i was trying this tutoriali got the tables just fine but when i try the 'regmee2' part (procedure i think) it doesnt work it keeps saying (error 1064 syntax error) or something along those lines. someone pls help me?Code:(forum.codecall.net/php-tutorials/13410-register-upload-photo-have-new-page-each-user-after-registration.html)
ps i had to put link to tut in code box because of my post count.
anyone plz, its so frustrating![]()
Hi niko619,
When debugging, be patient and look over the code carefully.
It looks like you've identified the problem area.
Look at your insert queries carefully!!
You have 3 tables images, users and user_images.
You have 3 insert queries, look close at the table names your trying to insert to.
Now you see it, don't you...
The table name is users not dbo_users
If a schema/user was being used then dbo.users would
be the syntax, but your not using a schema ref. in the
other insert queries so stick to just users and hopefully
it's not a reserved word.
Most important, when something doesn't work...
Start breaking it down into simpler expressions until it works,
then build it back up.
Good Luck fellow forum newbie!!
joined about the same time
hey thanx for the reply. ive tried what you said still same syntax error, ive had to change my semicolons to comas for the procedure to get past the 1st part. i have changed all names to what i thought they should be, and its always the same error on the same line. (error below)
Code:#1064 - 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 'insert into users (user_name,password,firstname,lastname,email) values (user_na' at line 6
Then you should break it down...
Drop the stored procedure and run 3 individual queries directly.
It's late, work with you tomorrow if you don't have it resolved by then.
Hi niko,
Any progress?
If your still having a problem, post all the code so I can take a look.
We'll fix it, php w/ MySQL is very straightforward.
At work now, but I'll have time at home later.
Hang in there...
but NOT by the neck!!![]()
Hope you succeeded, if not
post everything and we'll find the problem
k ive tried doing the procedure from php still same line but i get this error instead
always this codeCode:Parse error: syntax error, unexpected T_STRING
then i tried the query insert and it comes up with "query was empty"Code:CREATE DEFINER=`root`@`localhost` PROCEDURE `forum`.`regmee2`(img2 varchar(200), usrnme varchar(20), psswrd varchar(50), frstnme varchar(50),lstnme varchar(50),email varchar(255))
this is the code
i think its what it should be but remember im a noob lolCode:$query = mysql_query ("INSERT INTO images (image_url) values (img2)");
$query = mysql_query ("INSERT INTO users ('$user_name/$file','$user_name','$password','$firstname','$lastname','$email')");
$query = mysql_query ("INSERT INTO user_images (user_id ,image_id )");
$result =mysql_query ($query,$conn) or die (mysql_error());
![]()
OK niko,
I can't debug without seeing all your code,
so here I made an example that will work
with your forum database and the users table.
Call up data_input.php
fill in the boxes and submit
then data_input_script.php will insert your entries into the database
If your successful, then you can build back up to 3 queries, etc...
GOOD LUCK!!
your current database name: forum
current table name and description: users
user_id int(10) NOT NULL AUTO_INCREMENT, (primary key)
user_name - varchar(20) DEFAULT NULL,
password - varchar(50) DEFAULT NULL,
firstname - varchar(50) DEFAULT NULL,
lastname - varchar(50) DEFAULT NULL,
bad - tinyint(1) DEFAULT NULL,
email - varchar(255) DEFAULT NULL,
role_id - int(10) DEFAULT NULL,
put this in a file named data_input.php
fill in your password at $passwordname = " " and put thisCode:<?php echo "<html>"; echo "<body>"; echo "<form action='data_input_script.php' method='post'>"; echo "<br />User Name: <input type='text' name='input_name' size='20' maxlength='20' /><br />"; echo "<br />Password: <input type='text' name='input_password' size='50' maxlength='50' /><br />"; echo "<br />First Name: <input type='text' name='input_first' size='50' maxlength='50' /><br />"; echo "<br />Last Name: <input type='text' name='input_last' size='50' maxlength='50' /><br />"; echo "<br />Email: <input type='text' name='input_email' size='255' maxlength='255' /><br />"; echo "<br /><br />"; echo "<br /><input type='submit' />"; echo "</form>"; echo "</body>"; echo "</html>"; ?>
code in a file named data_input_script.php
Don't build a released internet site with this structure,Code:<?php $databasename = "forum"; $hostname = "localhost"; $username = "root" $passwordname = "your_password" //OPEN MYSQL CONNECTION $connectionname = mysql_connect($hostname, $username, $passwordname) or die ("Unable to Connect"); //SELECT DATABASE mysql_select_db($databasename, $connectionname) or die ("Unreachable Database"); //QUERY $queryname = "INSERT INTO users (user_name, password, firstname, lastname, email) VALUES ('$_POST[input_name]', '$_POST[input_password]', '$_POST[input_first]', '$_POST[input_last]', '$_POST[input_email]') //EXECUTE QUERY mysql_query($queryname, $connectionname); //CLOSE CONNECTION mysql_close($connectionname); print("Record Inserted"); ?>
you need to hide the database connection info
in a directory ABOVE the public one, but for testing
this structure is easily understood.
Last edited by debtboy; 09-01-2009 at 11:48 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks