Thread Starter
turkel
(@turkel)
My script code is this:
<?php
error_reporting(E_ALL);
$db_connect = mysql_connect("localhost","root","");
if (!$db_connect) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("wpmu_global", $db_connect);
$sqlid = "SELECT * FROM wp_blogs";
$result1 = mysql_query($sqlid) or die(mysql_error());
while($row = mysql_fetch_array($result1)){
$blogid = array($row['blog_id']);
$data = $row['blog_id'];
}
mysql_close($db_connect);
$db_connect = mysql_connect("localhost","root","");
if (!$db_connect) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("wpmu_1", $db_connect); //first db and i will run script for each db
foreach ($blogid as &$data) {
echo $sql = "CREATE TABLE IF NOT EXISTS <code>wp_".$data."_commentmetaTest</code> (
<code>meta_id</code> bigint(20) unsigned NOT NULL AUTO_INCREMENT,
<code>comment_id</code> bigint(20) unsigned NOT NULL DEFAULT '0',
<code>meta_key</code> varchar(255) DEFAULT NULL,
<code>meta_value</code> longtext,
PRIMARY KEY (<code>meta_id</code>),
KEY <code>comment_id</code> (<code>comment_id</code>),
KEY <code>meta_key</code> (<code>meta_key</code>)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
}
$result = mysql_query($sql) or die(mysql_error());
mysql_close($db_connect);
?>
if the multi db plugin skipped the extra tables, talk to the people you got the plugin from.
Thread Starter
turkel
(@turkel)
actually, Multi DB seems works because newly created blogs have required table. Problem is on old ones and that is why i have created this script for to create tables on DBs. This code not works because of Multi DB as i understand.
Read this:
http://ocaoimh.ie/wpmu-add-commentmeta/
And go back to where you got the plugin from and ask them how they handled it with multi dbs.
Thread Starter
turkel
(@turkel)
ahh perfect that is what i am trying to create. They have created it as plugin which i have not thought that way lol.
Thank you very much Andrea_r 🙂