Ciao a tutti ho un grosso problema, di recente ho provato ad importare un db su ***** di circa 30.000 record sembra essere andato tutto a buon fine ma non mi funziona il db. Su lnk dove risiede tutt'ora non ho problemi... In effetti alcuni script vanno e altri no. Ad esempio questo
codice:
<?php
error_reporting(E_ALL);
include("top_foot.inc.php");
include("config.inc.php");
include("connect.inc.php");
top();
$keys = explode (",", $chiave);
$query = "";
reset ($keys);
while (list(,$parola) = each ($keys))
{ $parola = trim($parola);
if ($parola != "")
$query .= "titolo LIKE '%$parola%' OR ingredienti LIKE '%$parola%' OR tipopiatto LIKE '%$parola%' OR ingredienteprincipale LIKE '%$parola%' OR regione LIKE '%$parola%' OR note LIKE '%$parola%' OR ";
}
$query .= "0";
$query = "SELECT id, titolo, ingredienteprincipale, regione FROM DBRicette WHERE " . $query;
$result = mysql_query($query, $db);
//echo $query; dopo l'esecuzione di una query ne mostra il risultato a video
while ($row = mysql_fetch_array($result))
{ echo "<a href=\"view.php?id=$row[id]\">" . " $row[titolo]" . " </a>
"; }
foot()
?>
su aruba non và. Ovviamente il primo script la variabile la prende da un file contenente un form.
mentre se eseguo questo
codice:
<?php
########## File corrente: newsinfo.php ###########
include ("config.inc.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?php echo $website; ?> - Situazione Database ricette</title>
<meta name="ROBOTS" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<div align="center" class="text">Situazione attuale delle ricette per il sito <?php echo $website; ?> </div>
<?php
//mi connetto a mysql
$db = mysql_connect($db_host, $db_user, $db_password) or die ("Connessione al database non riuscita");
mysql_select_db($db_name, $db) or die ("Selezione del database non riuscita");
//ricavo le versioni di PHP e MySQL installate sul server
$php_ver = phpversion();
$mysql_ver = mysql_get_server_info();
//ricavo dimensioni della tabella news
$statustable = mysql_query("SHOW TABLE STATUS") or die("Errore: " . mysql_error());
$status_row = mysql_fetch_array($statustable);
$tablesize = $status_row["Data_length"];
$indexsize = $status_row["Index_length"];
$size = $tablesize + $indexsize;
//converto i bytes in KB e MB
$tipo = "bytes";
if ($size > 1024) {
$size = $size / 1024;
$tipo = "KB";
}
if ($size > 2048) {
$size = $size / 2048;
$tipo = "MB";
}
$size = number_format($size,1);
//conto quante notizie ci sono nel database
$query = "SELECT count(*) AS tot FROM $db_tab";
$result = mysql_query ($query, $db);
while ($row = mysql_fetch_array($result)) {
$totale = $row['tot'];
}
//stampo i risultati ottenuti dalle precedenti operazioni
echo "<div align=\"center\" class=\"text\">Generale</div><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" bgcolor=\"#EEEEEE\"><tr><td class=\"text2\">News presenti nel database: $totale
Dimensioni della tabella "$db_tab": $size $tipo
Versione MySQL: $mysql_ver
Versione PHP: $php_ver";
echo "</td></tr></table>
";
echo"<h1 align=\"center\"><font size=\"5\">Le ultime ricette inserite</font></h1>
";
$query = "SELECT id, titolo, tipopiatto, regione FROM DBRicette ORDER BY id DESC LIMIT 0,10";
$result = mysql_query($query, $db);
while ($row = mysql_fetch_array($result))
{ echo "<a href=\"view.php?id=$row[id]\">" . " $row[titolo] " . $row[tipopiatto] . " $row[regione]</a>
"; }
//stampo la struttura della tabella dello script
echo "<div align=\"center\" class=\"text\">Dump tabella (solo struttura)</div><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" bgcolor=\"#EEEEEE\"><tr><td class=\"text2\">
DROP TABLE IF EXISTS $db_tab;
CREATE TABLE $db_tab (
id INT (5) UNSIGNED not null AUTO_INCREMENT,
titolo VARCHAR (50) not null ,
regione VARCHAR (50) not null ,
tipopiatto TEXT not null ,
ingredienteprincipale` VARCHAR(50) NULL,
persone INT (2) ,
ingredienti TEXT not null ,
preparazione TEXT not null ,
note TEXT ,
difficolta VARCHAR (12) ,
PRIMARY KEY (id))";
echo "</td></tr></table>";
//chiudo la connessione a mysql
mysql_close($db) or die ("Impossibile chiudere la connessione con MySQL");
?>
[/b]<div align="center"><input type="button" onclick="self.close()" name="close" value="Chiudi">
</body>
</html>
funziona e restituisce i dati corretti quindi fisicamente il db funziona. Cosa puo' essere???