Location: PHPKode > projects > Mozart > Mozart-0.0.4/migrate004.php
<?
// called from: none. for migrating to version 0.0.4 only
// description: reads the contact.contact_id and contact.owner fields and inserts them into the userxcont table.
//
include("connect.inc");
include("reqlogin.inc");
include("userprefs.inc");
?>
<html>
<title>Mozart: Migrate004.php</title>
<body bgcolor=<? echo $bgcolor ?> text=<? echo $txtcolor ?>>
<br>
<b>Processing contact table. . .</b>
<br>
<?
$ListSQL = "SELECT contact_id, owner FROM contact";
$List = mysql_query($ListSQL);

$errno = mysql_errno($db);
$error = mysql_error($db);

if (!($errno == 0)) {
   print("Error $errno: $error :: reading contact table");
   exit;
}

while ($list = mysql_fetch_array($List)) {
   $ContactID = $list["contact_id"];
   $Owner     = $list["owner"];
   $UserXContSQL = "INSERT INTO userxcont (userxcont_id, xuser_id, xcont_id) VALUES (NULL, '$Owner', '$ContactID')";
   $UserXCont    = mysql_query($UserXContSQL);

  $errno = mysql_errno($db);
  $error = mysql_error($db);

  if (!($errno == 0)) {
     print("Error $errno: $error :: inserting to userxcont table");
     exit;
  }
  else {
     printf("Inserting Contact %s for User %s into userxcont table<br>", $ContactID, $Owner);
  }
}
?>
<br>
Conversion complete.  You may now delete this program and proceed with the instructions in the UPGRADE file.
</center>
</body>
</html>
Return current item: Mozart