0

I was try this by using this code. used the while loop but there is no solutions.

$counter= 0;
  $result= $cid->query("SELECT ComName FROM catcom"); 
  echo $count=$result->num_rows;
  while ($row= $result->fetch_assoc()) {
      $field_value[] = $row;
      $counter++;
  }

Array store the name of the field $field_value[] is it possible to store data to data base, like this code if possible to how to write syntax.

while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $import="INSERT into  $field_value[] values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]')";

1 Answer 1

1

Field names in a relational database should not change dynamically.
You have to learn relational architecture and design your database to make its fields stay firmly on their places, not running like ants before rain.

Sign up to request clarification or add additional context in comments.

3 Comments

Sir, i am changing the name and update new field. '$sql = "ALTER TABLE commissions ADD $head_db_name VARCHAR(255) NOT NULL AFTER Comm_id";' and similar i am updating the field name query("UPDATE catcom SET ComName ='$head_db_name', ComFullName ='$head_name', cat_id ='$cat_value' WHERE CatComId = '$ComId'") == TRUE)
and it could be change any time by Update Field name.
Actually i want to store data by using the, Xls file and store into the database now , and every time the Xls file fields are changed, and according to file, DATA base field are changed, now tell me that how can i upload file ??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.