Invalid query: No database selected Whole query: INSERT INTO sigarette (id, marca, catrame, nicotina, monossido) VALUES (null, 'BARI ', 8,00 ,0,60 ,7,00 )
questo è l'errore che mi da'
ti posto tutto il code:
praticamente non ho fatto altro che un copia e incolla e ho cambiato i vari nome delle variabili...codice:<?php require_once('Connections/leggi_txt.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <?php $file=file_exists("siga.txt"); if($file==true) { $file=fopen("siga.txt","a+"); //$array = file("siga.txt"); //$max = count($array); } else { echo "file non trovato!"; } //echo $max; //$i = 0; while(! feof($file)) { $marca = fgets($file); //fgets legge una riga alla volta dal file e si posiziona alla prox $catrame =fgets($file); $nicotina =fgets($file); $monossido =fgets($file); //qui prepari l'inserimento al DB $query = "INSERT INTO sigarette (id, marca, catrame, nicotina, monossido) "; $query .=" VALUES (null, '$marca', $catrame,$nicotina,$monossido)"; $result = mysql_query($query); // Controlli che sia andato tutto ok if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } } /* $leggi=fread($file,filesize("siga.txt")); $sss=nl2br($leggi); echo $sss;*/ ?> </body> </html>
tutto il resto (quello che avevo fatto) l'ho commentato
sono nelle tue mani...

Rispondi quotando