网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > Web Directory
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 218.2.28.123
Old 2007-08-17, 02:55 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default Category description length (varchar 255) can increase?

Here is the code:

Quote:
<?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.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
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

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 10:59 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.