I am fighting with a jquery load thing that is supposed to load some comments into my comments area.
I use this
$("#designCommentsBox").load("pullcomment.php");
and my pullcomment.php looks like this:
<?php
define("INCLUDE_DIR", "includes/classes");
/* Autoload classes when used */
function __autoload($class_name) { include(INCLUDE_DIR.'/class.'. strtolower($class_name) . '.php'); }
SQLHandling::SQLconnect();
Designs::GetCommentsForDesign(1); //Default value for testing
?>
And the function GetCommentsForDesign is this:
function GetCommentsForDesign($design_id) {
$sql = SQLHandling::selectSQL('*', 'tdic_comments', 'design_id = '. $design_id .'');
$result = SQLHandling::SQLquery($sql);
$markers = array();
$markers["###NUM_COMMENTS###"] = mysql_num_rows($result);
if(mysql_num_rows($result) < 1) {
$markers["###COMMENTS###"] = "No comments";
} else {
while($row = SQLHandling::SQLfetch($result)) {
$markers["###COMMENTS###"] = '<div class="commentBox">';
$markers["###COMMENTS###"] .= '<div class="commentLeft"><img src="ss.jpg" /></div>';
$markers["###COMMENTS###"] .= '<div class="commentRight">';
if(!empty($row["website"])) {
$markers["###COMMENTS###"] .= '<span class="commentPoster"><a href="'. $row["website"] .'" target="_blank" rel="external nofollow">'. $row["name"] .'</a></span>';
} else {
$markers["###COMMENTS###"] .= '<span class="commentPoster">'. $row["name"] .'</span>';
}
$markers["###COMMENTS###"] .= '<br /><span class="commentDate">'. date('d-m-Y', $row["date_added"]) .'</span>';
$markers["###COMMENTS###"] .= '<p class="comment">'. $row["comment"] .'</p>';
$markers["###COMMENTS###"] .= '</div>';
$markers["###COMMENTS###"] .= '</div>';
}
}
Main::GetMarkers($markers);
}
The load is supposed to load all comments into to this but I am not getting anything
<div id="designCommentsBox">
</div>
What is weird that if I f.x. do an echo $row["comment"] inside the GetCommentsForDesign function, that comment do get printed out.
Can anyone see what I am doing wrong?
A secondary question
How can I pass an URL parameter into to load? Like this
$("#designCommentsBox").load("pullcomment.php?designid=1"); //From the URL
And then pass that param into the function?
Nevermind! I had some bad javascript further dowm my site! With that gone, everything is in order! Sorry!