Solved it now:
PHP Code:
<?php
include ('mysqlconnnection.php'); //include connection
$arrExclude = array('userId', 'userName', 'userPass', 'firma', 'orgnr', 'Scroll');
$result = mysql_query("SHOW COLUMNS FROM $table") or die("mysql error");
$numColumns = mysql_num_rows($result);
$x = 0;
while ($x < $numColumns)
{
$colname = mysql_fetch_row($result);
if(!in_array($colname, $arrExclude)) {
$col[$colname[0]] = $colname[0];
}
$x++;
}
$col2= array_diff($col,$arrExclude); //removes arrExclude from the created array $col
$querycx = 'UPDATE '.$table.' SET '. implode( '=\'\', ', $col2 ) .'=\'\''; //new array is used in mysql query
mysql_query($querycx);
?>
Bookmarks