note 72174 deleted from function.vsprintf by nlopess

From: Date: Fri, 05 Jan 2007 20:32:05 +0000
Subject: note 72174 deleted from function.vsprintf by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-121334@lists.php.net to get a copy of this message
Note Submitter: 2ge at 2ge dot us ---- This is small script, which I use to import some other export: <?php $sql_insert = " INSERT INTO subs_partners SET Partner = '%s', PartnerID = '%s', Name = '%s', Object = '%s' ON DUPLICATE KEY UPDATE ID = ID"; $handle = fopen($url, "r") or die("Can't open URL: $url"); while (!feof($handle)) { $ar = explode("\t", str_replace("\n", "", fgets($handle))); if(empty($ar[1])) continue; $data = array( 'Partner' => 'partnername', 'PartnerID' => $ar[0], 'Name' => $ar[1], 'Object' => serialize ( array( 'category' => $ar[2], 'size' => $ar[3], 'uploaders' => $ar[4], 'downloaders' => $ar[5] ) ) ); foreach($data as $key => $value) { $data[$key] = $db->SqlCorrection($value); } $db->DbQuery(vsprintf($sql_insert, $data)); } fclose($handle); ?> Hope it will help someone

« previous php.notes (#121334) next »