PDA

View Full Version : help me smash this bug


N!ck
10-08-2002, 02:17 AM
Does anyone see anything wrong with this query? ::


$newforuminfo=$DB_site->query("SELECT forum.*,postthanks.* FROM forum LEFT JOIN postthanks ON (forum.forumid=postthanks.postthanksid) WHERE forumid='".$foruminfo[forumid]."'");


When I put $newforuminfo[message] in the template, the variable appears to not be set (it's blank).

This is for a hack I'm making, so anyone who can help me out will get credit.

Thanks.

N!ck
10-08-2002, 02:21 AM
btw, i've got a table called "postthanks" that i'm trying to join. that table contains a field called "message", which is what i'm trying to retrieve.

Xenon
10-08-2002, 11:56 AM
don't use query if you want to work with the variable, you have to use query_first:
$newforuminfo=$DB_site->query_first("SELECT forum.*,postthanks.* FROM forum LEFT JOIN postthanks ON (forum.forumid=postthanks.postthanksid) WHERE forumid='".$foruminfo[forumid]."'");

N!ck
10-08-2002, 12:57 PM
ah, thank you very much!

N!ck
10-08-2002, 01:14 PM
i guess that wasn't the *only* problem. i'm going to call this a failed project before i have too much time invested. :)

Xenon
10-08-2002, 01:24 PM
well it depends on where's the template read out.

if you use standartredirect with $newforuminfo[postthanks] it won't work, because $newforuminfo isn't a global var...

am i right?

if yes you have to open admin/functions.php
find // ###################### Start standardredirect( #######################
function standardredirect($message="",$url="") {
// print standard redirect page

global $header,$footer,$headinclude,$headnewpm,$toplinks, $forumjump,$timezone,$bbtitle,$hometitle,$bburl,$h omeurl,$copyrighttext,$privacyurl,$contactuslink,$ webmasteremail,$technicalemail,$faxnumber,$address ,$companyname,$titleimage,$replyimage,$newthreadim age,$closedthreadimage,$lastvisitdate,$timenow,$se ssion;

$title=$bbtitle;

$pagetitle = "$title";
$errormessage = $message;

$url = str_replace("\"", "", $url);

eval("dooutput(\"".gettemplate("standardredirect")."\");");
exit;

}

and add $newforuminfo into the global line

N!ck
10-08-2002, 09:46 PM
mmm! yes! i'm glad i didn't toss the readme file yet...i'm gonna re-apply this hack and try that. thanks.

N!ck
10-08-2002, 11:16 PM
:/ still isn't cooperating. if it's not a huge deal, maybe i could send you the hack so you could take a look at the file edits and see what might be wrong. if it is, that's fine. i've pretty much given up anyway. :)

Xenon
10-09-2002, 09:46 AM
no problem, send per pm, i'll see what i can do

N!ck
10-09-2002, 12:54 PM
thanks :)