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
https://forums.phpfreaks.com/topic/25904-php-and-data/
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
https://forums.phpfreaks.com/topic/25904-php-and-data/#findComment-119465
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
https://forums.phpfreaks.com/topic/25904-php-and-data/#findComment-119641
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.