사이트 내 전체검색
PHP
테이블 column type 을 확인해서 TEXT 로 바꾸는 방법
하우코드
https://cmd.kr/php/971 URL이 복사되었습니다.

본문

column type from a MYSQL database using PHP and store that in a variable

   

$q = mysql_query('DESCRIBE tablename');

while($row = mysql_fetch_array($q)) {

    echo"{$row['Field']} - {$row['Type']}\n";

}


$rst = sql_query("DESCRIBE $write_table");

while($row = sql_fetch_array($rst)) {

if ($row['Field']=='wr_8' && strstr($row['Type'],'varchar(')) {

$sql="ALTER TABLE `$write_table` CHANGE `{$row['Field']}` `{$row['Field']}` TEXT NOT NULL";

sql_query($sql,true);

}

    //echo "{$row['Field']} - {$row['Type']}\n";

}

   

   

   


 


 

wr_id - int(11) wr_num - int(11) wr_reply - varchar(10) wr_parent - int(11) wr_is_comment - tinyint(4) wr_comment - int(11) wr_comment_reply - varchar(5) ca_name - varchar(255) wr_option - set('html1','html2','secret','mail') wr_subject - varchar(255) wr_content - text wr_seo_title - varchar(255) wr_link1 - text wr_link2 - text wr_link1_hit - int(11) wr_link2_hit - int(11) wr_hit - int(11) wr_good - int(11) wr_nogood - int(11) mb_id - varchar(20) wr_password - varchar(255) wr_name - varchar(255) wr_email - varchar(255) wr_homepage - varchar(255) wr_datetime - datetime wr_file - tinyint(4) wr_last - varchar(19) wr_ip - varchar(255) wr_facebook_user - varchar(255) wr_twitter_user - varchar(255) wr_1 - varchar(255) wr_2 - varchar(255) wr_3 - varchar(255) wr_4 - varchar(255) wr_5 - varchar(255) wr_6 - varchar(255) wr_7 - varchar(255) wr_8 - text wr_9 - varchar(255) wr_10 - varchar(255)

댓글목록

등록된 댓글이 없습니다.

PHP
871 (1/18P)

Search

Copyright © Cmd 명령어 3.147.62.99