Diff of /createPasswords/trunk/createPasswords.php [r187] .. [r188] Maximize Restore

  Switch to side-by-side view

--- a/createPasswords/trunk/createPasswords.php
+++ b/createPasswords/trunk/createPasswords.php
@@ -29,31 +29,31 @@
 
 ini_set("memory_limit", "256M");
 
-require_once("../classes/MySQLConnectionFactory.class.php");
+require_once("classes/MySQLConnectionFactory.class.php");
 
-$mysqli = MySQLConnectionFactory::createi();
+$mysql = MySQLConnectionFactory::create();
 
 $query = 'SELECT cardnumber FROM borrowers WHERE password IS NULL';
 
 $patronData = array();
-if ( $result = $mysqli->query( $query ) ) {
+if ( $result = mysql_query( $query ) ) {
+
   /* fetch associative array */
-  while ( $row = $result->fetch_assoc() ) {
+  while ( $row = mysql_fetch_assoc($result) ) {
     $cardnumber = $row['cardnumber'];
     $userid = $cardnumber;
     $password = md5_base64( $cardnumber );
     
-    $query = $mysqli->prepare("UPDATE borrowers SET password = ?, userid = ? WHERE cardnumber = ?");
-    $query->bind_param( 'sss', $password, $userid, $cardnumber );
-    if ( $query->execute() ) {
-      echo "Created login and password for cardnumber $cardnumber\n";
-    } else {
-      die( "Failed to create login and password for cardnumber $cardnumber\n" );
+    $query = "UPDATE borrowers SET password = '" . mysql_escape_string($password) . "', userid = '$userid' WHERE cardnumber = '$cardnumber'";
+    $rows = mysql_query( $query );
+    echo $rows . " rows affected.\nCardnumber $cardnumber\n";
+
   }
 
-  /* free result set */
-  $result->close();
-} else { printf("Connect failed: %s\n", $mysqli->error ); }
+  
+} else { 
+  printf("Connect failed: %s\n", mysql_error() ); 
+}
 
 function md5_base64 ( $data ) {
   return rtrim( base64_encode( pack( "H*", md5( $data ) ) ), "=" );