View Single Post
  #3 (permalink)  
Old 07-20-2009, 10:09 AM
edhan's Avatar
edhan edhan is offline
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Aug 2003
Location: Singapore
Posts: 745
edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4edhan RepRank 4
Question Re: What's wrong with this command?

Quote:
Originally Posted by kgun View Post
I am a little away from SQL now, but

have you tried the command from SQL command level?

Just wondering: Should it be

... ADD COLUMN ...
post_category is the column I want to add after the post_title. I have done it in phpMyAdmin and it works. But I have alot of wordpress blogs to update so thinking of just writing a small php file where it will be easier to update them. I still can't figure out where I went wrong. arrrgghhhh ...

SOLVED:

Change the command to be like this:

Code:
<?
require('wp-config.php');
$db_wp_connection = mysql_pconnect(DB_HOST, DB_USER, DB_PASSWORD) or trigger_error(mysql_error(),E_USER_ERROR);

$database_name=DB_NAME;

mysql_select_db($database_name, $db_wp_connection);
$p_sql="select * from wp.posts";
$rs_table = mysql_query($p_sql, $db_wp_connection);
	$sq = "ALTER TABLE wp_posts ADD post_category INT (4) NOT NULL AFTER post_title";

mysql_query($sq) or die(mysql_error()." (script line: ".__LINE__.")");
?>

Last edited by edhan; 07-20-2009 at 10:18 AM.
Reply With Quote