saiprashanth Posted April 1, 2014 Share Posted April 1, 2014 I have created a web page where my customers will be able to enter details of all items there return back to my store. I have created in such a way that, 1 customer can enter his personal details once but can add any number of items he is returning. I have created a "add more" button to do this job. I have used arrays for this job, but when I am testing my site, database is not taking the items entered and is not displayed by phpMyAdmin. index.php.txt Quote Link to comment Share on other sites More sharing options...
hansford Posted April 1, 2014 Share Posted April 1, 2014 Where is the id coming from? (surplus_id) If the id is auto generated then you don't need to insert it. Try using error reporting at the top of the php page to see if any errors are generated during the transaction. error_reporting(E_ALL); ini_set('display_errors',1); Check if the rows were actually inserted by using something like: printf("Rows updated: %d\n", mysql_affected_rows()); You should also look into using PDO for your database interactions to prevent sql injection attacks. Quote Link to comment Share on other sites More sharing options...
saiprashanth Posted April 1, 2014 Author Share Posted April 1, 2014 Where is the id coming from? (surplus_id) If the id is auto generated then you don't need to insert it. Try using error reporting at the top of the php page to see if any errors are generated during the transaction. error_reporting(E_ALL); ini_set('display_errors',1); Check if the rows were actually inserted by using something like: printf("Rows updated: %d\n", mysql_affected_rows()); You should also look into using PDO for your database interactions to prevent sql injection attacks. surplus_is is auto increment number. I have removed it as suggested as is fine with that. The php statement for error checking has found no errors. My output shows like this on phpmyadmin surplus_id datetime name dept email phone comments model outag itemdesc Edit Copy Delete 3 2014-04-01 15:34:46 Sai Prashanth Ramasetti CS saiprash.r@gmail.com 5015515478 NA Array Array Array Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 2, 2014 Share Posted April 2, 2014 if you are using an array for your form fields and are getting the name 'Array' for data, wouldn't that indicate you need to use some sort of php array function to loop over the submitted data to access each set of possible values that were entered? see this link - http://www.php.net/manual/en/control-structures.foreach.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.