年年我发



返回   年年我发 > 网站建设 > 建站交流 > Web Directory
用户名
密码
 
注册账号 论坛帮助 会员列表 日历事件网赚工具 标记版面已读

回复
 
主题工具 搜索本主题 显示模式
  #1   IP: 218.2.28.123
旧 2007-08-17, 02:55 AM
topvip topvip 当前离线
超级版主
 
注册日期: 2006-01-04
帖子: 618
精华: 11
现金: 4905 元
资产: 7353 元
声望: 10 topvip 正向着好的方向发展
默认 Category description length (varchar 255) can increase?

Here is the code:

引用:
<?php
/************************************************
* INSTALL:

* Place this in your main folder, after you

* run it, please rename it or remove it from

* the site so no one else could use it on your

* database.

*

************************************************/





// Include the initialization info

include('init.php');



// Add a new field

$sql = "ALTER TABLE {$tables['category']['name']} ADD DESC_LONG TEXT NULL AFTER DESCRIPTION";



// If that completed alright, then lets continue on, otherwise DIE DIE DIE!!

if (!$db->Execute($sql))

{

die (mysql_error());

}



// Now, lets grab the DESCRIPTIONS, and input them into the new field

$sql = "SELECT ID, DESCRIPTION FROM {$tables['category']['name']}";



// Pull the results

$data = $db->GetAll($sql);



// Now lets do the ole switch arooo

foreach($data as $row)

{

// Update SQL, it now switches the two DESCRIPTION's around

$db->Execute("UPDATE {$tables['category']['name']} SET DESC_LONG = '" . $row['DESCRIPTION'] . "' WHERE ID = {$row['ID']}");

}



// Now, for the final step we'll rename DESCRIPTION to DESCRIPTION_OLD, and DESC_LONG to DESCRIPTION

$db->Execute("ALTER TABLE {$tables['category']['name']} CHANGE DESCRIPTION DESCRIPTION_OLD VARCHAR( 255 ) NULL DEFAULT NULL") or die (mysql_error());



$db->Execute("ALTER TABLE {$tables['category']['name']} CHANGE DESC_LONG DESCRIPTION TEXT NULL DEFAULT NULL") or die (mysql_error());



echo "All went fine... I guess ; )";



?>

save as description.php, and run it with ie. and deleted it.
回复时引用此帖

wellcome to www.0058.net
回复


当前查看此主题的会员: 1 (0 位会员和 1 位游客)
 
主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

论坛启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
论坛跳转

相似的主题
主题 主题作者 版面 回复 最后发表
Adding Description to the Category page (phpld) topvip Web Directory 0 2007-08-17 01:44 AM
Increase description and allow HTML in description entry (phpld) topvip Web Directory 1 2007-07-10 02:29 AM
Category descriptions (phpld) topvip Web Directory 1 2007-07-10 02:04 AM


所有时间均为北京时间. 现在的时间是 10:39 AM, Free Patent & Patent Ideas


Powered by vBulletin 3.5.2 Chinese Exhibition Happy New Year
©2000 - 2009,Jelsoft Enterprises Ltd  Desiccant Molecular Sieve Weight Loss Bentonite Trade Manager