Jump to content

php and data


jagguy

Recommended Posts

Hi,

When using php with mysql do you check for data problems with php and not mysql. The reason is that if you add a duplicate record for a primary key field mysql gives an error (not user friendly). So if you use pphp to check the to see if the data already exists then the mysql error won't be needed (you will search a table first manually with php before adding).

This is a php issue and not a mysql issue , to help the user with data problems.
Link to comment
Share on other sites

q)Say I get an error with mysql and I want to redo my form entry screen.

How can i get the html to select a php server program based on output, eg if true run this php file else run this file?

q) Also how can i get a preview screen to happen with php,html as i want the user to see the form data and decide whether this is what they want to submit?
Link to comment
Share on other sites

you would use mysql_error() to display the current error. for example:

mysql_query('select blah from table') or die(mysql_error());

as far as the "preview my form before I submit" thing - one way to do it is to have your form, user inputs their info, they submit the form.  on the target script, you would display their info based on the posted variables in this "previewed" format that which you speak of.  You would also want to start a session and make some session variables (or an array would be easier) to hold this information. then have your little button or whatever for the user to send it off for really real or go back and make changes.  Whichever button the user decides to click, you would auto-insert the form with the session vars or else process their info using the session vars.         
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.