I'm running a code to get the columns names of a table but I want all the values except the first and the second.
<select name="TableNum" class="table">
<?php
include 'connectDb.php'; #Eisagwgi stoixeiwn gia syndesi me ti vasi
$result=mysqli_query($con,"SELECT COLUMN_NAME FROM
INFORMATION_SCHEMA.Columns where TABLE_NAME = 'available'");
while($row = mysqli_fetch_array($result)) {
echo '<option>'.$row[0].'</option>';
}
?>
</select>
I know from Python how to use an array, and also I read this thread in W3Schools.
Also, with a simple print_r, I get as result this:
Array ( [0] => Date [COLUMN_NAME] => Date )
Array ( [0] => Time [COLUMN_NAME] => Time )
Array ( [0] => A1 [COLUMN_NAME] => A1 )
Array ( [0] => A2 [COLUMN_NAME] => A2 )
Array ( [0] => A3 [COLUMN_NAME] => A3 )
Array ( [0] => A4 [COLUMN_NAME] => A4 )
Array ( [0] => B1 [COLUMN_NAME] => B1 )
Array ( [0] => B2 [COLUMN_NAME] => B2 )
Array ( [0] => B3 [COLUMN_NAME] => B3 )
Array ( [0] => B4 [COLUMN_NAME] => B4 )
Array ( [0] => B5 [COLUMN_NAME] => B5 )
Array ( [0] => B6 [COLUMN_NAME] => B6 )
Array ( [0] => C1 [COLUMN_NAME] => C1 )
Array ( [0] => C2 [COLUMN_NAME] => C2 )
How could i get only the last 12 values(A1-A1,B1-B6,C1,C2) and put it back to option tag.
Thanks
DateandTimecolumns, by addingAND TABLE_NAME NOT IN ('Date', 'Time')afterwhere TABLE_NAME = 'available'.AND COLUMN_NAME NOT IN ('Date', 'Time')(I wrote table instead of column). That should do the trick - then no additional PHP is needed, and everything is done in SQL!