- Home
- Categorie
- Coding e Sistemistica
- Coding
- ricevo un errore? mi aiutate a capire dove?
-
ricevo un errore? mi aiutate a capire dove?
ecco un mio file che include le ultime notizie di un wordpress
ma ricevo questo errore
[PHP]
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in [path]/inclusion/inclusion.php on line 36
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in [path]/inclusion/inclusion.php on line 36
[/PHP]mi aiutate a capire come farlo scomparire? ecco il file!!
[PHP]<?
require("inclusion.config.php");
$connessione=mysql_connect($dbss_server, $dbss_username, $dbss_passwd);
$dbss = mysql_select_db($dbss_name, $connessione);
?>
<link rel="stylesheet" type="text/css" href="inclusion.css">
<table width="100%" cellpadding="0" cellspacing="0" class="inc_tbl1">
<tr>
<td height="30" align="center" valign="middle" class="inc_tbl1_title" style="width:40%">
<?=$inc_title1?>
</td>
<td style="width:30%" valign="middle" align="center" class="inc_tbl1_title">
<?=$inc_title2?>
</td>
<td style="width:30%" valign="middle" align="center" class="inc_tbl1_title">
<?=$inc_title3?>
</td>
</tr>
<tr>
<td style="width:<?=$wCol1?>" valign="top">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<?
unset($noId);
$qLastArticle = mysql_query("SELECT ID, post_content, post_title, guid, post_name FROM $tbl_post_wp WHERE post_status = 'publish' AND post_parent = '0' ORDER BY post_date DESC LIMIT $n_last_article");
while($rLastArticle = mysql_fetch_assoc($qLastArticle)){$noId .= " AND id!= '$rLastArticle[ID]' "; $qLastArticleImg = mysql_query("SELECT guid post_nameFROM $tbl_post_wp WHERE post_mime_type LIKE 'image/%' AND post_parent = '$rLastArticle[ID]' ORDER BY post_date ASC LIMIT 1"); $rLastArticleImg = mysql_fetch_assoc($qLastArticleImg); ?> <td style="padding:2px"> <a href="<?=$rLastArticle[post_name]?>.html"><b><?=$rLastArticle[post_title]?></b></a> <div style="clear:both;height:5px"></div> <div id="LastArticle"> <? if($rLastArticleImg[guid] != ""){ ?> <div id="imgLastArticle"> <img src="<?=$base?>phpThumb/phpThumb.php?src=<?=$rLastArticleImg[guid]?>&w=<?=$img_width?>&h=<?=$img_height?>&q=100"> </div> <? } ?> <?=substr(strip_tags($rLastArticle[post_content]),0,$lengthLastArticle)?>... </div> </td> <? } ?> </tr> </table> </td> <td style="width:<?=$wCol2?>" valign="top"> <table width="100%" cellpadding="0" cellspacing="0" class="inc_tbl2"> <? $qTenArticle = mysql_query("SELECT ID, post_title, guid, post_name FROM $tbl_post_wp WHERE post_status = 'publish' AND post_parent = '0' $noId ORDER BY post_date DESC LIMIT 10"); while($rTenArticle = mysql_fetch_assoc($qTenArticle)){ ?> <tr> <td><a href="/<?=$rTenArticle[post_name]?>.html"><b><?=$rTenArticle[post_title]?></b></a></td> </tr> <? } ?> [/PHP]
-
Ciao flaffy,
aggiungi or die(mysql_error()); nelle query per vedere gli errori di sintassi, in quanto dovrebbe dipende da questo.
-
no non so dove metterlo...sono niubbo totale
-
inserisci questo codice dopo <?php
[PHP]
error_reporting(E_ALL);
[/PHP]
così come è scritto,compreso le maiuscole.

-
ora provo
-
ricevo sempre
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in [path]/inclusion/inclusion.php on line 41
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in [path]/inclusion/inclusion.php on line 41
-
invece di questo
[PHP]
mysql_fetch_assoc
[/PHP]
prova questo
[PHP]
mysql_fetch_array($qLastArticle);
[/PHP]

-
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in [path]/inclusion/inclusion.php on line 41
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in [path]/inclusion/inclusion.php on line 41
è inutile oggi non me ne va bene una….sento che è una fesseria ma non so che fare!!
-
Al posto di:
[php]
$qLastArticle = mysql_query("SELECT ID, post_content, post_title, guid, post_name FROM $tbl_post_wp WHERE post_status = 'publish' AND post_parent = '0' ORDER BY post_date DESC LIMIT $n_last_article");
[/php]
Metti:
[php]
$qLastArticle = mysql_query("SELECT ID, post_content, post_title, guid, post_name FROM $tbl_post_wp WHERE post_status = 'publish' AND post_parent = '0' ORDER BY post_date DESC LIMIT $n_last_article") or die(mysql_error());
[/php]
Ed al posto di:
[php]
$qTenArticle = mysql_query("SELECT ID, post_title, guid, post_name FROM $tbl_post_wp WHERE post_status = 'publish' AND post_parent = '0' $noId ORDER BY post_date DESC LIMIT 10");
[/php]
Metti:
[php]
$qTenArticle = mysql_query("SELECT ID, post_title, guid, post_name FROM $tbl_post_wp WHERE post_status = 'publish' AND post_parent = '0' $noId ORDER BY post_date DESC LIMIT 10") or die(mysql_error());
[/php]Incolla qui gli errori che ti mostrerà, cosi vediamo quali problemi hanno le query.
-
fatto!!! ricevo sempre questo
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in [path]/inclusion/inclusion.php on line 41
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in [path]/inclusion/inclusion.php on line 41
-
è normale che mi mostra solo e sempre lo stesso errore?
-
Puoi indicarci cosa c'è nella riga 41 del tuo file? Che così non mi è possibile capire quale sia.
-
pare sia questa, ho incollato il codice in dreamweaver:
$rLastArticleImg = mysql_fetch_assoc($qLastArticleImg);
-
Al posto di:
[php]
$qLastArticleImg = mysql_query("SELECT guid post_nameFROM $tbl_post_wp WHERE post_mime_type LIKE 'image/%' AND post_parent = '$rLastArticle[ID]' ORDER BY post_date ASC LIMIT 1");
[/php]
Metti:
[php]
$qLastArticleImg = mysql_query("SELECT guid post_name FROM $tbl_post_wp WHERE post_mime_type LIKE 'image/%' AND post_parent = '$rLastArticle[ID]' ORDER BY post_date ASC LIMIT 1") or die(mysql_error());
[/php]
Mi sembra l'errore sia solamente la mancanza di uno spazio, in caso non sia quello vediamo che errore genera.
-
GRANDEEEEEEEEEEEEEEEE non c'è più errore!!!