D
D
Develm2015-12-03 10:51:47
PHP
Develm, 2015-12-03 10:51:47

Cyclic addition in mysql how?

There is a code:

$a = $_POST['colums'];
    if($a != null){
      for ($i = 1, $i<$a; $i++){	
        $query = "ALTER TABLE maps ADD days_'$i' VARCHAR(100)";
        mysql_query($query);
      }
    }

the cycle is working but ALTER TABLE does not want to add and does not show an error (the code was removed for an error)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2015-12-03
@Develm

$query = "ALTER TABLE maps ADD days_".$i." VARCHAR(100)"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question