I'm a newb at web programming. Ugh, this is making me crazy! I've been programming it all day.
I need expert's help. Please help me guys!!
I've been trying to make a Sign Up filter and insert to database code. The code first checks if the username inputted in the sign up exists in the database. If it does, it will ignore the sign up transaction and goes back to index.php. If it doesn't it will store all the inputs to the database.
After inputting, I'm trying to get the idNum (primary key, auto increment) from table 'user' of the newly inputted record and put it in visitNum (primary key for table visit but not auto increment. Table visit is very dependent to table user). But as you can see, I don't know how.
I'm using phpdev423
I have very many problems.
1. First time I sign up, the record is successfully registered in the database. After the first sign up, it won't work anymore. I input a record, it will display "Sign Up Complete" but I don't see anything in the phpmyadmin database. And when I input the same username, it will recognize the username and it will prevent me from registering the record. But when I look at the database, the record isn't there. I tried inputting a record in phpmyadmin manually. It will work and sign up will work again.
2. I already have 4 records in the database. The idNum are 101, 102, 103 and 104. I inputted my 4th record manually. When I input my fifth record from the sign up page, this thing is displayed: Error: Duplicate entry '103' for key 1. I don't understand, isn't idNum supposed to be at 105? My idNum is autoincrement, it's not supposed to be 103.
3. I don't know how to retrieve idNum without using mysql_fetch_array. How do I retrieve an idNum without using mysql_fetch_array.
So, here's my code.