0

lets say it in example,i had column, which its rows contain numbers increasing -10,-9,-8,-7,....-1, those rows got bugged and changed into 1,2,3,4,.....10,
that was example, the real one is over 40,000 rows, and it was -2147483629,-2147483630,-2147483631,....etc and it turned into 1000000001,1000000002,1000000003,....
how to make script that scan for 1000000001~1000000050 (for example) and make it change them into -2147483629~-2147483679 ?

1
Contributor
2
Replies
3
Views
6 Years
Discussion Span
Last Post by DarkBerzerk
0

This is my first try:

<?php
  $config = array(
    'db_username' => 'Dusername', // database username
    'db_password' => 'pass',   // database password
    'db_dsn'      => 'kal_db',   // system DSN to the database

    'debug'       => false,               // show SQL errors if true
);



        $conn = odbc_connect($config['db_dsn'],
                             $config['db_username'],
                             $config['db_password']);
 
  
  $iid = "SELECT
			IID
        FROM
            Item
		WHERE
			IID > 0";
  $iidcodes = odbc_exec($conn,$iid);
  while($r = odbc_fetch_array($iidcodes)){
	$iids = $r['IID'];
	$newiid = -500;
	$changesql = "	UPDATE	Item
							SET
								IID		=  '$newiid'
							WHERE
									IID = '$iids'
								";
	$donechanging = odbc_exec($conn,$changesql);
	$newiid++;
  }
  ?>

Edited by DarkBerzerk: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.