Quote:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/gioloves/public_html/wp-content/plugins/zenP.php on line 58i suspect it's got something to do with prefix of the tables in zenphoto db. As my tables have no prefix, i did not enter anything in line 36 "define('zp_PRE',$conf['']); // prefix of the tables in db"
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/gioloves/public_html/wp-content/plugins/zenP.php on line 63
Quote:add_filter('the_content', 'zenp');Did i change the 2nd line correctly? Are there more lines to change/edit ?
[b]require_once ("/home/gioloves/public_html/gallery/zen/config.php");
[/b]
define('zp_DB',$conf['mysql_database']); // database of your zenp
[b]define('zp_PATH','http://giolovesgod.com/gallery'); [/b]
define('zp_PRE',$conf['mysql_prefix']); // prefix of the tables in db
function zenp($text) {
preg_match_all("#\[zp\](.*?)\[/zp\]#si",$text,$matches);
if(count($matches[0])==0) return $text;
for ($i=0; $i < count($matches[0]); $i++) {
$pos = strpos($text, $matches[0][$i]);
$gallery = $matches[1][$i];
$replace=wpzp(trim($gallery));
$text = substr_replace($text, $replace ,$pos,strlen($matches[0][$i]));
}
mysql_select_db(DB_NAME);//select the db of wordpress, or wp will not work.
return $text;
}
function wpzp($album,$n=5){
$db=mysql_select_db(zp_DB);
$result = mysql_query("SELECT * FROM `".zp_PRE."albums` WHERE `folder` = \"". $album ."\" LIMIT 1");
$_album = mysql_fetch_assoc($result);
//suppose the album exists.
$result = mysql_query("SELECT * FROM `".zp_PRE."images` WHERE `albumid` = \"".$_album['id']."\" ORDER BY RAND() LIMIT ".$n);
$imgs = array();
while ($row = mysql_fetch_assoc($result))
$imgs[] = $row;
$width=count($imgs)*89;
$str="<span style=\"width:{$width}px;text-align:center;border:1px solid #eeeeee;padding:0;background:#eeeeee;display:block\">";
$str .="Album: $album<a>";
foreach($imgs as $img) {
$str .= "<img style=\"padding:2px 2px 4px 2px;display:inline\" src=\"".zp_PATH."/zen/i.php?a=" . urlencode($album) . "&i=" . urlencode($img['filename']) . "&s=thumb\" alt=\"\" />";
}
$str.="</a></span>";
return $str;
}
?>
Quote:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/gioloves/public_html/wp-content/plugins/zenP.php on line 58Help me?
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/gioloves/public_html/wp-content/plugins/zenP.php on line 63
Album: desktops