Location: PHPKode > projects > Myphpim > MyPhPim-01.05/changeaddresses.php3
<?php
#this small script puts the content of fields 'street', 'nr' and 'bus' from the addresses table
# into the address field 
include "conf/global_conf.inc";
 
$html = new HtmlCl;
$db = new DB;
$result = $db->query ( "SELECT street, nr, bus FROM addresses" );
$numrows = $db->numrows ( $result );
for ( $i = 0; $i < $numrows; $i++ ) {
	$street = $db->result ( $result, $i, "street" );
	$nr = $db->result ( $result, $i, "nr" );
	$bus = $db->result ( $result, $i, "bus" );
	if ( $nr == "0" ) { 
		$tmpnr = ""; 
	} else {
		$tmpnr = $nr;
	}

	$address = $street . " " . $tmpnr . " " . $bus;
	echo "$address<br>";
	$result2 = $db->query ( "UPDATE addresses set address='$address' where street='$street' and nr='$nr' and bus='$bus' ");
	echo "insert Done";
}
?>
Return current item: Myphpim