INSERT INTO prepared statements, PHP MYSQL, optimising a lot of columns -
please me understand how optimize mysql queries in php. when have lot of columns, prepared statement looks
$inst = $db->prepare("insert year_$year (user_name,type_of_day,month_row,day_1,day_2,day_3,day_4,day_5,day_6,day_7,day_8,day_9, day_10,day_11,day_12,day_13,day_14,day_15,day_16,day_17,day_18,day_19,day_20,day_21,day_22,day_23,day_24,day_25,day_26,day_27,day_28,day_29,day_30,day_31) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); $inst->execute($chunk_post[$init]);
this code here: http://govnokod.ru/php?page=356 people ridicule shitty codes.
i not understand how in other way.
a little joke:
u can use for ($i = 1; $i <= 31; i++) {}
construct query ;)
the reality:
read database normalization here: http://databases.about.com/od/specificproducts/a/normalization.htm
your ultimate goal should third normal form.
you should think day linked 1 month.
think table month
, table day
.
read sql join
.
sure, not have datatype datetime
?
this question way broad give solution instead of learn here, learn there answer. question basics.
Comments
Post a Comment