Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/287454-unable-to-add-all-columns-on-phpmyadmin/
Share on other sites

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.

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 

 
 
 
 
 
 
 
 
 
 
 
s_fulltext.png surplus_id datetime name dept email phone comments model outag itemdesc dot.gif Edit dot.gif Copy dot.gif Delete 3 2014-04-01 15:34:46 Sai Prashanth Ramasetti CS saiprash.r@gmail.com 5015515478 NA Array Array Array
 

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

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.