$q"); return $result; } //______________________________________________________________________________________________ function insert_record ($table,$string_filds,$array_values) { if($string_filds!='') {$string_filds="( $string_filds ) "; } $string_values="VALUES("; while(list($i,$v)=each($array_values)) { if(gettype($array_values[$i])=='string') { if($i < count($array_values)-1) {$string_values.="'$v'," ;} else {$string_values.="'$v'" ; } } else {if($i < count($array_values)-1) {$string_values.="$v," ;} else {$string_values.="$v" ; } } } $string_values.=")"; $q="INSERT INTO $table $string_filds $string_values "; mysql_query($q) or die("no insert record into $table
$q"); } //______________________________________________________________________________________________ function delete_record ($table,$condition) { $q="DELETE FROM $table WHERE $condition"; mysql_query($q) or die("no delete record from $table
$q"); } //______________________________________________________________________________________________ function update_record ($table,$string_filds,$condition) { if($condition!='') { $condition="WHERE $condition"; } $q="UPDATE $table SET $string_filds $condition"; mysql_query($q) or die(mysql_error()."
$q
"); } //______________________________________________________________________________________________ //build table for sorte data function show_table ($array_label,$array_result,$array_align,$width,$border,$array_color) { // deffault settings if($array_color[0]==''){$array_color[0]='#ffffff'; } if($array_color[1]==''){$array_color[1]='#000000'; } if($array_color[2]==''){$array_color[2]='#8000FF'; } if($array_color[3]==''){$array_color[3]='#ffffff'; } if($array_color[4]==''){$array_color[4]='#C6C6FF'; } if($array_color[5]==''){$array_color[5]='#A6A6FF'; } if($array_align[0]==''){$array_align[0]='center';} if($array_align[1]==''){$array_align[1]='center';} if($border=='') { $border='0'; } echo ""; while (list($i,$v)= each($array_label) ) { echo""; while($row=mysql_fetch_row($array_result)) { $c++; $color= $array_color[5]; if($c%2==0) { $color=$array_color[4]; } echo""; while (list($i,$v)= each($row) ) { echo ""; } echo"
$v"; } echo"
$v"; } echo "
"; } //______________________________________________________________________________________________ ?>