/    Sign up×
Community /Pin to ProfileBookmark

php/mysql issues

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.

to post a comment
PHP

22 Comments(s)

Copy linkTweet thisAlerts:
@TheRaveFeb 27.2008 — 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.
Copy linkTweet thisAlerts:
@MrCoderFeb 27.2008 — What's the odd's on javascript being at fault?
Copy linkTweet thisAlerts:
@the-ferretFeb 27.2008 — and you added the fields to the database?
Copy linkTweet thisAlerts:
@MrCoderFeb 27.2008 — and you added the fields to the database?[/QUOTE]

*Hands Ferret his magic seeing stone*
Copy linkTweet thisAlerts:
@dvdd127authorFeb 27.2008 — and you added the fields to the database?[/QUOTE]
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.
Copy linkTweet thisAlerts:
@chazzyFeb 27.2008 — can you add an error check after your last mysql_query (when you do the insert)

something like
[code=php]
or die(mysql_error());
[/code]
Copy linkTweet thisAlerts:
@dvdd127authorFeb 28.2008 — doing that just causes a php error that say there is unexpected code.
Copy linkTweet thisAlerts:
@radeFeb 28.2008 — doing that just causes a php error that say there is unexpected code.[/QUOTE]
Did you get any php errors referring to a specific line number?
Copy linkTweet thisAlerts:
@radeFeb 28.2008 — 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 ?
Copy linkTweet thisAlerts:
@MrCoderFeb 28.2008 — You should remove the MySQL connection details from the uploaded files!
Copy linkTweet thisAlerts:
@chazzyFeb 28.2008 — doing that just causes a php error that say there is unexpected code.[/quote]

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

when you do your query...

[code=php]
mysql_query("your_insert_query_goes_here") or die(mysql_error());
[/code]


Something like that.
Copy linkTweet thisAlerts:
@k_wsakaFeb 28.2008 — 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.
Copy linkTweet thisAlerts:
@dvdd127authorFeb 28.2008 — 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 ?[/QUOTE]

Thank you ?

You should remove the MySQL connection details from the uploaded files![/QUOTE]
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...

[code=php]
mysql_query("your_insert_query_goes_here") or die(mysql_error());
[/code]


Something like that.[/QUOTE]
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.[/QUOTE]
umm. no offense.. but what does this have to do with you. I am the one asking for help in this thread.
Copy linkTweet thisAlerts:
@dvdd127authorFeb 28.2008 — after adding the missing dollar signs and the [code=php]or die(mysql_error()[/code] ... 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'[/QUOTE]
Copy linkTweet thisAlerts:
@chazzyFeb 28.2008 — See how much a little error reporting helps?

See this part of your query...

<i>
</i>,<span><code>Notes</code></span>,[B]'StateRepresentedNo1'[/B],<span><code>RepresentativeContactWebSiteForStateNo1</code></span>,<span><code>SecretRepresentativeWebSiteForStateNo1</code></span>,<span><code>StateRepresentedNo2</code></span>

StateRepresentedNo1 is surrounded by '', but should be surrounded by ``
Copy linkTweet thisAlerts:
@dvdd127authorFeb 28.2008 — 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[/QUOTE]
Copy linkTweet thisAlerts:
@dvdd127authorFeb 29.2008 — any ideas?
Copy linkTweet thisAlerts:
@radeFeb 29.2008 — Try checking every " and ' and making sure they are where they should. And that there's no " where there should be ' and vice versa.
Copy linkTweet thisAlerts:
@dvdd127authorFeb 29.2008 — i have done this multiple times... and everything seems to be good there.
Copy linkTweet thisAlerts:
@dvdd127authorFeb 29.2008 — 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'[/QUOTE]

I have attached the new code for you to see what I have changed.
Copy linkTweet thisAlerts:
@dvdd127authorFeb 29.2008 — 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

[upl-file uuid=d5ed245a-2771-4207-b30a-aa736a34807d size=14kB]signupck.php.txt[/upl-file]
Copy linkTweet thisAlerts:
@dvdd127authorMar 01.2008 — anyone got any ideas?

TIA
×

Success!

Help @dvdd127 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...