0

Hello,

I have a newoffer php page wich has a form for inserting new data in a mysql database. When the page newoffer.php is opened, a new record will insert with the values NULL. When the form is completed, the record will update with the new information. But if the user will not complete the form fields, how can I remove that new record?

Thank you,
Alex.

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by ghostdog_alex
1

Why are you creating a NULL record? Doesn't make much sense to me. Just do an INSERT on form completion, then you don't have to do anything.

If you really MUST do this, add a timestamp to the page opening process -> DB. You can use a cron job for 'garbage collection', i.e. delete all NULL records with a timestamp greater than say 4 hours (or whatever).

Use cron job to run a php script that contains the mysql query (delete). BUT, as I mention, this shouldn't really be req'd.

Edited by diafol: n/a

0

Why are you creating a NULL record? Doesn't make much sense to me. Just do an INSERT on form completion, then you don't have to do anything.

If you really MUST do this, add a timestamp to the page opening process -> DB. You can use a cron job for 'garbage collection', i.e. delete all NULL records with a timestamp greater than say 4 hours (or whatever).

Use cron job to run a php script that contains the mysql query (delete). BUT, as I mention, this shouldn't really be req'd.

Thank you for your answer. I have a sliding-form (tabbed form) for multiple fields. On the final tab, the user will save the images for the new offer (this is done by creating a new folder with the offer name, that will contain the images. This process is made by ajax, javascript and php upload). So, when the user will submit the form, how can i pass the files path, so i can inset them into the database? Should i show you the codes?

Thank's again for the support,
Alex

0

you can keep intermediate data in session variables.

0

you can keep intermediate data in session variables.

Thank you a lot for the support. I didn't think about the sessions.

Thank you again,
Alex

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.