php signup form with image upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: php signup form with image upload

Post by Celauran »

Can you post the entire file? The line numbers in the errors don't make any sense given the code you've posted.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: php signup form with image upload

Post by Celauran »

What does redirect_to do? If it's a header redirect, it's going to fail because headers have already been sent when you echoed "File uploaded.. etc"
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: php signup form with image upload

Post by Celauran »

MySQL error no 1062 : Duplicate entry 'ianhaney' for key 'username'
That's pretty straightforward: there's already a user with that username in the DB. That's because you're executing the same query twice

Code: Select all

                                $result = $mysqli->query($sql);

if ($mysqli->query($sql)) {
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: php signup form with image upload

Post by Celauran »

UNIQUE was probably a better choice, and I've explained why you're seeing it twice.
Post Reply