Revision: 51665
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 1, 2011 03:25 by terataz
Initial Code
<?php //script per il controllo del supplier e verifica se le songs sono ancora attive $db_host = "soundreef.cgwpjynqhrxz.eu-west-1.rds.amazonaws.com"; $db_username = "dbuser"; $db_password = "yatudob"; $db_name = "soundreef"; mysql_connect("$db_host","$db_username","$db_password") or die("Sorry we could not connect to our database."); mysql_select_db("$db_name") or die("No database"); $fileCont = join('', file('totale song scelte.csv')); $fileArrN = explode("\n", $fileCont); $a = 0; foreach ($fileArrN as $value){ $fileArrSemi[$a] = explode(";", $value); $a++; } $csv=''; $not_found=''; for($i = 0; $i < sizeof($fileArrSemi); $i++){ $artist = mysql_real_escape_string(trim($fileArrSemi[$i][0],"\"")); $title = mysql_real_escape_string(trim($fileArrSemi[$i][1],"\"")); $artist_trimmed = trim($artist); $title_trimmed = trim($title); $q="SELECT active, supplier_id, artist, title from song where TRIM(title) like '".$title_trimmed."' and TRIM(artist) like '".$artist_trimmed."'"; $r=mysql_query($q); $result=mysql_fetch_row($r); $csv .= $result[0].";".$result[1].";".$artist_trimmed.";".$title_trimmed."\n"; } $file=fopen("result.csv",w); fwrite($file,$csv); fclose($file); $file=fopen("notfound.csv",w); fwrite($file,$not_found); fclose($file); ?> ?>
Initial URL
Initial Description
Initial Title
Check Supplier and If Active
Initial Tags
csv
Initial Language
PHP