Table " . $temp_related . " created

"; } else { $error = 1; $error_html = "Could not create table " . $temp_related . "."; } if(!isset($error)){ echo "

Extracting old table data...

\n"; $sql = "select * from $tb_related"; $query = sql_query($sql); while($rows = sql_fetch_array($query)){ for($x=1;$x<6;$x++){ if($rows["R$x"] > 0){ $cat_id[] = $rows["Category"]; $rel_id[] = $rows["R$x"]; } } } $z = sizeof($cat_id); echo "

Converting data:

\n"; for($q=0;$q<$z;$q++){ $insert_sql = " insert into $temp_related ( id, cat_id, rel_id ) values ( '', '$cat_id[$q]', '$rel_id[$q]' ) "; if($rel_id[$q] > 0){ if($insert_query = sql_query($insert_sql)){ $t++; echo "

Relationship #" . $t . " converted.

\n"; } else { $error = 1; } } } echo "

Data conversion complete.

\n"; } echo "

I will now drop your old " . $tb_related . " table.

\n"; $drop_sql = "drop table " . $tb_related; if($drop_query = sql_query($drop_sql)){ echo "

Table " . $tb_related . " dropped.

"; } echo "

I will now rename your new table " . $temp_related . ".

\n"; $mv_sql = "alter table " . $temp_related . " rename as " . $tb_related; if($mv_query = sql_query($mv_sql)){ echo "

Table " . $temp_related . " renamed as " . $tb_related . ".

\n"; } if(!isset($error)){ echo "

I am finished... ;)

\n"; } else { echo "

Oh No! :(

\n"; } } else { $sql = "select * from $tb_related"; $query = sql_query($sql); while($rows = sql_fetch_array($query)){ for($x=1;$x<6;$x++){ if($rows["R$x"] > 0){ $rel_id[] = $rows["R$x"]; } } } $count = sizeof($rel_id); } if(isset($submit) && !isset($error)){ ?>

A total of Unique Category Relationships were converted.

Please delete this script now : .

I encountered an error:

Please make sure your mysql connection information is correct in config.php, and that the user is allowed to create and drop tables.

Convert Related Categories - 2.1.1 -> 2.1.2

Hello, I am a php script named convert_related_2.1.1-2.1.2.php. I will convert your current Related Categories table into a much more efficient format. It seems destiney wasn't as informed on sql table relationships as he should have been when he first began the phpLinks project long ago. I will fix his mistakes by converting your related table to a new structure ;)

I have to use a temporary table in your database to do the conversion. I plan to create a table named . If this is ok with you please proceed, if not please change the name in the form below.