PHP/mySQL Help

They have: 3 posts

Joined: Apr 2000

Hello-
I wrote a script in PHP that takes information from a form, and enters it into a database. However, the script only actually writes to the mySQL database periodically... it's not consistant. Can anyone give me an idea of what I might be doing wrong?

Thank you,
Casey

Casey Hansen
CaseyNet Online Design
http://www.caseynet.com

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I don't get it.. the script will write to the database without being 'asked to'?

Can you post the script (minus the password stuff)? or is it too big?

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 334 posts

Joined: Dec 1999

I'm not sure I understand. Are you saying that sometimes when the form is processed it enters the info into the database and sometime it doesn't? If that's the case, there are a couple of things to check.

1) Make sure it's getting fed valid data. It could be choking on getting text fed into an int() field like if you have an input for Age: set as int(3), and somebody is trying to enter: sixteen in the form.

2) Are the inserts conditional? Like if $foo == 1 {
insert into etc etc etc} In that case, the state of $foo could be the culprit, so make sure it's set properly.

3) Check for unique fields. If you have a date or name field set as UNIQUE the data won't get entered if there's already an entry from that name or date.

4) Are NULL fields allowed? If you have something set as NOT NULL and that input is left blank on the form, the insert will fail.

It would help if you included your FORM code, the db table set-up and the INSERT statement here

[Edited by Maverick on 09-06-2000 at 02:03 PM]

They have: 60 posts

Joined: Aug 2000

Yes, you should always check all input before submit/change/edit the data

minor question: How could we determine that ALL the possibilities have been taken into account? Or wait until the user discover them (and may even hack the system down!)

http://new.123finder.com/ - Helps you find cool domains for FREE & Registers it for only $14.95/yr
http://www.ad-rotator.com/ - Free ad rotating system for small websites - Stop Ctrl-P/Ctrl-C the ad code!

------
Son

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.