Click to See Complete Forum and Search --> : php/mysql issues


dvdd127
02-27-2008, 12:19 AM
I am not sure what part of my code, if any, would be needed to help me with this issue.. so i will explain the issue and then you guys can tell me what you want to see.. and i will post it.

I have two files one is a form that when submitted it goes through the second file which is supposed to save the data to a database. All I did was add some fields to the form and now it does not submit to the database anymore.

I have went through and made sure that all the code in the second file to make sure that all the fields that were added have been added in the second file as well.

any ideas on what happened?

Thanks in advance for helping.

TheRave
02-27-2008, 02:38 AM
Post up both files of code (remember to use the php and/or html BBCode tags when posting code). Then we can at least partly understand what's happening.

MrCoder
02-27-2008, 10:09 AM
What's the odd's on javascript being at fault?

the-ferret
02-27-2008, 10:20 AM
and you added the fields to the database?

MrCoder
02-27-2008, 10:24 AM
and you added the fields to the database?

*Hands Ferret his magic seeing stone*

dvdd127
02-27-2008, 05:01 PM
and you added the fields to the database?
yes.. of course.

Here are the two files.. and now that you mention javascript I would not be surprised if that is the reason.... but please look at the files and let me know what you think.

in an effort to shorten the post I have attached text files with the code from each of the files in them.

Thank you in advance.

chazzy
02-27-2008, 05:16 PM
can you add an error check after your last mysql_query (when you do the insert)

something like

or die(mysql_error());

dvdd127
02-27-2008, 10:30 PM
doing that just causes a php error that say there is unexpected code.

rade
02-28-2008, 04:48 AM
doing that just causes a php error that say there is unexpected code.
Did you get any php errors referring to a specific line number?

rade
02-28-2008, 04:55 AM
I found one thing at least:

In the mysql_query values you've missed the '$' from RepresentativeContactWebSiteForStateNo3 and RepresentativeContactWebSiteForCountryNo3.

I don't think that is what's causing the problem you have, but I figured you might want to know ;)

MrCoder
02-28-2008, 05:00 AM
You should remove the MySQL connection details from the uploaded files!

chazzy
02-28-2008, 05:40 AM
doing that just causes a php error that say there is unexpected code.

I didn't meant to just throw it anywhere,sorry.

when you do your query...


mysql_query("your_insert_query_goes_here") or die(mysql_error());


Something like that.

k_wsaka
02-28-2008, 10:53 AM
thank you Kelly23 and SuzanneB !! my problem is that i don't have idea of this PHP scripts i saw and hear of it but basically i don't know how exactly it should be writen. does any one have any idea of generating this PHP scripts automatically as when we develop the form in Macromedia Dreamweaver 8.

Thank you ,with regards awaiting for your reply.

dvdd127
02-28-2008, 11:12 AM
I found one thing at least:

In the mysql_query values you've missed the '$' from RepresentativeContactWebSiteForStateNo3 and RepresentativeContactWebSiteForCountryNo3.

I don't think that is what's causing the problem you have, but I figured you might want to know ;)
Thank you :)

You should remove the MySQL connection details from the uploaded files!
Ooops.. I meant to do that. Forgot.. reattached the files to this post.

I didn't meant to just throw it anywhere,sorry.

when you do your query...


mysql_query("your_insert_query_goes_here") or die(mysql_error());


Something like that.as homer simpson would say, "d'oh"... I should have known that. My Bad.

I will do that and get back to you later.. have meetings for the next 3 or 4 hours.. then I will have time to play around with it.

thank you Kelly23 and SuzanneB !! my problem is that i don't have idea of this PHP scripts i saw and hear of it but basically i don't know how exactly it should be writen. does any one have any idea of generating this PHP scripts automatically as when we develop the form in Macromedia Dreamweaver 8.

Thank you ,with regards awaiting for your reply.umm. no offense.. but what does this have to do with you. I am the one asking for help in this thread.

dvdd127
02-28-2008, 04:13 PM
after adding the missing dollar signs and the or die(mysql_error() ... i am now getting this error:
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 ''StateRepresentedNo1','RepresentativeContactWebSiteForStateNo1'

chazzy
02-28-2008, 04:59 PM
See how much a little error reporting helps?

See this part of your query...


,`Notes`,'StateRepresentedNo1',`RepresentativeContactWebSiteForStateNo1`,`SecretRepresentativeWebSit eForStateNo1`,`StateRepresentedNo2`

StateRepresentedNo1 is surrounded by '', but should be surrounded by ``

dvdd127
02-28-2008, 05:14 PM
now i am getting this error
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 1

dvdd127
02-29-2008, 12:19 AM
any ideas?

rade
02-29-2008, 12:47 AM
Try checking every " and ' and making sure they are where they should. And that there's no " where there should be ' and vice versa.

dvdd127
02-29-2008, 01:29 AM
i have done this multiple times... and everything seems to be good there.

dvdd127
02-29-2008, 01:54 AM
i just changed the code a little bit to see if I could get a different error out of it..... now i get Unknown column 'StateRepresentedNo1' in 'field list'

I have attached the new code for you to see what I have changed.

dvdd127
02-29-2008, 02:29 AM
Ok, I managed to fix that problem.. the field in the database had a few extra spaces at the beginning and the end of it..

Now I am getting no errors.. and it is still not saving to the database...

any ideas?

Edit: I just attached the latest version of my file

dvdd127
03-01-2008, 12:17 AM
anyone got any ideas?

TIA