Salve a tutti
non sono un esperto di php, ma mi hanno dato degli script facilmente utilizzabili e quindi mi sto cimentando....
facendo dei test su un mio sito, riscontro uno strano errore, per la precisione un warning di questo tipo
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.mollyjones.net/home/cb/index2.php on line 187
l'indirizzo provvisorio su cui sto effettuando i test (indirizzo di mia proprietà su aruba) è il seguente:
www.mollyjones.net/cb
vi posto anche il codice php contenuto nella pagina in questione:
<?
require("manager1/config.php");
$connection = mysql_connect($dbhost, $dbusername, $dbpassword);
$cShowMax = 5;
?>
<?
$content = mysql_db_query($dbname, "select n.*, c.descrizione from newscontent n, categorie c
where n.id_categoria = c.id and (n.id_categoria=1 or n.id_categoria=2 or n.id_categoria=3 or n.id_categoria=4 or n.id_categoria=5)order by n.event desc");
$Xcontent = mysql_fetch_array($content);
if (($cShowMax == "999") OR ($cShowMax>=mysql_num_rows($content)))
{
$cShowMax = mysql_num_rows($content);
}
for ($y=1; $y<=$cShowMax; $y++)
{
$categ = strtoupper($Xcontent["descrizione"]);
$title = stripslashes($Xcontent["title"]);
$descrizione = stripslashes($Xcontent["news"]);
$caratteri=70;
if (strlen($descrizione) >= $caratteri) {
$descrizione = substr($descrizione, 0, $caratteri);
$posLastSpace = strrpos($descrizione, " ");
$descrizione = substr($descrizione, 0, $posLastSpace);
$descrizione = $descrizione."...";
}
$date = date("d/m/Y", strtotime($Xcontent["event"]));
$id = $Xcontent["id"];
echo "<table width=\"100%\" border=\"0\" valign=\"center\" bgcolor=\"f7f7f7\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td bgcolor=\"f7f7f7\">";
echo "<div align=\"left\">";
echo "<font color=\"000000\" face=Verdana, Arial, Helvetica, sans-serif size=1>";
echo "<b>$date </b>";
echo "<font color=#333333 face=Arial, Helvetica, sans-serif size=1>";
echo $descrizione."<a href=\"javascript:Zoom('modifica','modifica','dettagli_news.php?id_news=".$id."');\"><img src=\"obj/leggitutta.gif\" border=\"0\"></a> <br></td>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td><img src=\"obj/linea-gialla.gif\" width=\"100%\" height=\"5\">";
echo "</td>";
echo "</tr>";
echo "</table>";
$Xcontent = mysql_fetch_array($content);
}
mysql_free_result($content);
?>
potreste gentilmente dirmi quale potrebbe essere il problema?
grazie 1000
non sono un esperto di php, ma mi hanno dato degli script facilmente utilizzabili e quindi mi sto cimentando....
facendo dei test su un mio sito, riscontro uno strano errore, per la precisione un warning di questo tipo
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.mollyjones.net/home/cb/index2.php on line 187
l'indirizzo provvisorio su cui sto effettuando i test (indirizzo di mia proprietà su aruba) è il seguente:
www.mollyjones.net/cb
vi posto anche il codice php contenuto nella pagina in questione:
<?
require("manager1/config.php");
$connection = mysql_connect($dbhost, $dbusername, $dbpassword);
$cShowMax = 5;
?>
<?
$content = mysql_db_query($dbname, "select n.*, c.descrizione from newscontent n, categorie c
where n.id_categoria = c.id and (n.id_categoria=1 or n.id_categoria=2 or n.id_categoria=3 or n.id_categoria=4 or n.id_categoria=5)order by n.event desc");
$Xcontent = mysql_fetch_array($content);
if (($cShowMax == "999") OR ($cShowMax>=mysql_num_rows($content)))
{
$cShowMax = mysql_num_rows($content);
}
for ($y=1; $y<=$cShowMax; $y++)
{
$categ = strtoupper($Xcontent["descrizione"]);
$title = stripslashes($Xcontent["title"]);
$descrizione = stripslashes($Xcontent["news"]);
$caratteri=70;
if (strlen($descrizione) >= $caratteri) {
$descrizione = substr($descrizione, 0, $caratteri);
$posLastSpace = strrpos($descrizione, " ");
$descrizione = substr($descrizione, 0, $posLastSpace);
$descrizione = $descrizione."...";
}
$date = date("d/m/Y", strtotime($Xcontent["event"]));
$id = $Xcontent["id"];
echo "<table width=\"100%\" border=\"0\" valign=\"center\" bgcolor=\"f7f7f7\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td bgcolor=\"f7f7f7\">";
echo "<div align=\"left\">";
echo "<font color=\"000000\" face=Verdana, Arial, Helvetica, sans-serif size=1>";
echo "<b>$date </b>";
echo "<font color=#333333 face=Arial, Helvetica, sans-serif size=1>";
echo $descrizione."<a href=\"javascript:Zoom('modifica','modifica','dettagli_news.php?id_news=".$id."');\"><img src=\"obj/leggitutta.gif\" border=\"0\"></a> <br></td>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td><img src=\"obj/linea-gialla.gif\" width=\"100%\" height=\"5\">";
echo "</td>";
echo "</tr>";
echo "</table>";
$Xcontent = mysql_fetch_array($content);
}
mysql_free_result($content);
?>
potreste gentilmente dirmi quale potrebbe essere il problema?
grazie 1000