-
-
-
Try this:
<?php // configurazione $server=""; $username=""; $password=""; $database=""; // fine config mysql_connect($server,$username,$password); mysql_select_db($database); $db=file("webcam.txt"); $q="CREATE TABLE webcam("; $tbl=explode("|",$db[0]); foreach($tbl as $campo){ $q=$q.$campo." VARCHAR(255) NOT NULL,"; } $q=$q."TYPE=MyISAM".")"; mysql_query($q) or exit("Errore nella query"); $db=file("webcam.txt"); array_shift($db); foreach($db as $riga){ mysql_query("INSERT INTO webcam( ". implode(",",$tbl).")"." VALUES (". str_replace("|","','",$riga)."'); ") or exit("Errore nella query"); } ?>Ciao!
-
Il tuo script mi da Errore nella query, ma stavo pensando che non è indispensabile importare il contentuto di webcam.txt perchè tanto ho inserito solamente UNA webcam di prova, quindi se è più facile e non ti rubo tempo a te potrei anche creare il tutto manualmente da myadmin... (sempre che abbia capito bene la sintassi del tuo script :-D)
Dimmi tu secondo te com'è meglio...
A presto!
-
Bhè,se ricevi un errore fai pure da phpmyadmin che facciamo prima :D.
Crea una tabella chiamata webcam e inserisci i seguenti campi:
id INT 3 not null auto_increment
h1 VARCHAR 255 not null
h2 VARCHAR 255 not null
imgurl VARCHAR 255 not null
imgalt VARCHAR 255 not null
title VARCHAR 255 not nullPoi lo script per mostrare le webcam modificalo così:
<?php // configurazione $server=""; $username=""; $password=""; $database=""; // fine config mysql_connect($server,$username,$password); mysql_select_db($database); $webcam=mysql_fetch_assoc(mysql_query("SELECT * FROM webcam id='$_GET[id]'")); $id=$webcam[id]; $h1=$webcam[h1]; $h2=$webcam[h2]; $urlim=$webcam[imgurl]; $altim=$webcam[imgalt]; $title=$webcam[title]; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Webcam </title> <link href="wb.sc.it.css" rel="stylesheet" type="text/css"> </head> <body> <h1 class="h1"> <?php echo $h1?> </h1> <p class="h1"> <?php echo $h2?> </p> <table width="755" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#DFDFE1"> <tr> <td bgcolor="#000033"><img src="http://www.giorgiotave.it/forum/images/supner.jpg" width="757" height="60"></td> </tr> <tr> <td><div align="center"> <table width="755" border="0" cellpadding="0" cellspacing="0" class="regionetd"> <tr> <td width="202"><div align="center"><script type="text/javascript"><!-- google_ad_client = "pub-0471560296296297"; google_alternate_color = "333333"; google_ad_width = 120; google_ad_height = 240; google_ad_format = "120x240_as"; google_ad_type = "text_image"; google_ad_channel =""; google_color_border = "333333"; google_color_bg = "333333"; google_color_link = "FFFFFF"; google_color_url = "CCCCCC"; google_color_text = "CCCCCC"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></div></td> <td width="350"><div align="center"><img src="<?php echo $urlim?>"></div></td> <td width="202"><div align="center"><a href="http://www.webcam.sciclub.it/" class="framedx">Guarda le altre <strong>148 webcam</strong> sparse in tutta italia.</a></div></td> </tr> <tr> <td colspan="3"><script type="text/javascript"><!-- google_ad_client = "pub-0471560296296297"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text_image"; google_ad_channel =""; google_color_border = "333333"; google_color_bg = "333333"; google_color_link = "68BA34"; google_color_url = "666666"; google_color_text = "CCCCCC"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></td> </tr> </table> </div></td> </tr> <tr> <td class="testo"><div align="center" class="regionetd">Webcam by www.valtline.it </div></td> </tr> <tr> <td bgcolor="#000033" class="testo"><img src="http://www.giorgiotave.it/forum/images/infner.jpg" width="757" height="60"></td> </tr> </table> <table width="755" height="130" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="http://www.giorgiotave.it/forum/images/sup.jpg" width="760" height="20"></td> </tr> <tr> <td height="23" class="tabluad"><div align="center"><a href="http://www.webcam.sciclub.it/ad.htm" target="_blank" class="back2">Offerte Speciali </a></div></td> </tr> <tr> <td height="23" class="tabluad"><div align="center"><a href="http://www.sciclub.it" target="_blank" class="back2">Sci Club </a></div></td> </tr> <tr> <td height="23" valign="middle" class="tabluad"><div align="center"><a href="php/mail/form.php" target="_blank" class="back2"> Segnalaci una webcam</a></div></td> </tr> <tr> <td height="23" class="tabluad"><div align="center"> <div align="center"><a href="http://www.webcam.sciclub.it/" class="back2">» guarda le altre webcam «</a></div> </div></td> </tr> <tr> <td><img src="http://www.giorgiotave.it/forum/images/inf.jpg" width="760" height="20"></td> </tr> </table> <p class="copy">© 2005 <a href="http://www.webcam.sciclub.it" class="copy">www.webcam.sciclub.it</a>. - Tutti i diritti riservati - <a href="http://www.valtline.it/" class="copy">credits</a> - <a href="mailto:[email protected]" class="copy">email</a></p></body> </html>Ciao!
-
-
-
-
-
-
Buongiorno a tutti e complimenti, sono nuova del forum.
Sto seguendo questa traccia per imparare un minimo di PHP e creare qualche pagina di webcam di rifugi estivi. Invece del database utilizzo un classico file.txt.
Avrei bisogno di qualche linea guida della pagina thumbnail.php, se qualcuno ha qualche minuto da dedicarmi.
Grazie, fede
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi


