Categories > TinyButStrong general >

TBS Error Help

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Mankiy
Date: 2003-07-22
Time: 00:02

TBS Error Help

ok, heres what im trying to do......

I get results from two tables.....
user_info and posts

Guests will be posting, and ofc, it wont be in the table user_info b/c the guests will have basically their own name......

when i tried this code, i get this error:
error:
TinyButStrong Error (MergeBlock): The data source Id 'SELECT username,posts,location,joined,sign FROM hyperbb_members WHERE (username='%p1%')' is an unsupported keyword. And the corresponding custom function 'tbsdb_SELECT username,posts,location,joined,sign FROM hyperbb_members WHERE (username='%p1%')_open' is not found.

Code:
[tbs_check;if [user_info.username]=[post.posted_by];begin]
<!-- Begginning of Post Block and User Block -->
                 <postblock>
                 <userblock>
<!-- ####################################### -->

<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD width="700" bgcolor="#C9C9C9">
    <font size="1">Topic: [posts.topic;block=postblock]</font>
  </TD>
</TR>
</TABLE>

<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD width="150" bgcolor="#C9C9C9">
    <b>[user_info.username;block=userblock;p1=[posts.posted_by]]</b>
    <br>
    <br>
    <br>
    Location: [user_info.location]
    <br>
    Posts: [user_info.posts]
    <br>
    Joined: [user_info.joined]
  </TD>

<TD width="550" bgcolor="#C9C9C9" valign="top">
    [posts.post_text]
    <br>
___________________________
    <br>
    [user_info.sign]
  </TD>
</TR>
</TABLE>
<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD bgcolor="#C9C9C9">
    <font size="1">Posted On: [posts.post_date]</font>
  </TD>
</TR>
</TABLE>
<br>
<br>
<!-- End of Post Block and User Block -->
              </userblock>
              </postblock>
<!-- ################################ -->
[tbs_check;end]

[tbs_check;if [user_info.username]=[post.posted_by];begin]
<!-- Begginning of Post Block -->
            <postblock>
<!-- ######################## -->

<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD width="700" bgcolor="#C9C9C9">
    <font size="1">Topic: [posts.topic;block=postblock]</font>
  </TD>
</TR>
</TABLE>

<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD width="150" bgcolor="#C9C9C9">
    <b>[posts.posted_by]</b>
    <br>
    <br>
    <br>
    Location: Guest
    <br>
    Posts: Guest
    <br>
    Joined: Guest
  </TD>

<TD width="550" bgcolor="#C9C9C9" valign="top">
    [posts.post_text]
    <br>
___________________________
    <br>
    Guest
  </TD>
</TR>
</TABLE>
<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD bgcolor="#C9C9C9">
    <font size="1">Posted On: [posts.post_date]</font>
  </TD>
</TR>
</TABLE>
<br>
<br>
<!-- End of Post Block -->
        </postblock>
<!-- ################# -->
[tbs_check;end]

is there a different way i can do this check or anything im missing?
By: Mankiy
Date: 2003-07-22
Time: 00:09

Re: TBS Error Help

of can i jsut do the queries outside of the TBS function and merge them as an array.....

ex:
while ($row = mysql_fetch_array($sql)) {
$PAGE->MergeBlock("user_info", "$row[]");
}

This way i can better control everything i think....
By: Skrol29
Date: 2003-07-22
Time: 02:36

Re: TBS Error Help

Hi ManKiy,

It looks like you've ommited one parameter at the ->MergeBlock() function.
What is the corresponding PHP code for your template ?
By: Skrol29
Date: 2003-07-22
Time: 02:39

Re: TBS Error Help

Yes you can but not with the code you've done.

This one sould be better:
$recset = array() ;
while ($row = mysql_fetch_array($sql)) {
  $recset[] = $row ;
}
$PAGE->MergeBlock("user_info", $recset) ;
By: Mankiy
Date: 2003-07-22
Time: 02:51

Re: TBS Error Help

Its the reg one......

$PAGE->MergeField("TITLE", "HyperBB");
$PAGE->MergeBlock("posts", "mysql", "SELECT * FROM hyperbb_posts WHERE (topic_ID=$_GET['f'])");
$PAGE->MergeBlock("user_info", "mysql", "SELECT * FROM hyperbb_members WHERE (username='%p1%')");

Same as i had before, havent had time to change it right now......

probably will in about half hr after this post....
By: Mankiy
Date: 2003-07-22
Time: 02:53

Re: TBS Error Help

doh! >_<

lol, thought us aid php file, whoops......

I havent changed anything yet tho.....

<html>
<head>
<title> [TITLE] </title>
</head>
<body bgcolor="#FFFFFF">

<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
   <TR><TD bgcolor="#898989" width="150">
    <center><font size="3"> USER INFO </font></center>
  </TD>
   <TD width="550" bgcolor="#898989">
    <center><font size="3"> POST INFO </font></center>
  </TD></TR>
</TABLE>

<!-- Begginning of Post Block and User Block -->
                 <postblock>
                 <userblock>
<!-- ####################################### -->

<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD width="700" bgcolor="#C9C9C9">
    <font size="1">Topic: [posts.topic;block=postblock]</font>
  </TD>
</TR>
</TABLE>

<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD width="150" bgcolor="#C9C9C9">
    <b>[user_info.username;block=userblock;p1=[posts.posted_by]]</b>
    <br>
    <br>
    <br>
    Location: [user_info.location]
    <br>
    Posts: [user_info.posts]
    <br>
    Joined: [user_info.joined]
  </TD>

<TD width="550" bgcolor="#C9C9C9" valign="top">
    [posts.post_text]
    <br>
___________________________
    <br>
    [user_info.sign]
  </TD>
</TR>
</TABLE>
<TABLE border="0" cellspacing="1" cellpadding="0" width="700" align="center">
<TR>
   <TD bgcolor="#C9C9C9">
    <font size="1">Posted On: [posts.post_date]</font>
  </TD>
</TR>
</TABLE>
<br>
<br>
<!-- End of Post Block and User Block -->
              </userblock>
              </postblock>
<!-- ################################ -->

</body>
</html>
By: Mankiy
Date: 2003-07-22
Time: 03:40

Re: TBS Error Help

um, the template basically stays the same.....


but heres the PHP file:
<?php
   require("config.php");
   require_once($clsdir."tpl_class.php");


$PAGE = new tpl_class;
$PAGE->LoadTemplate($tpldir."show_posts.tpl");


// session start and check
session_start();
$username = $_SESSION["username"];
$password = $_SESSION["password"];
$posts = array();
$user_info = array();



$sql = mysql_query("SELECT * FROM hyperbb_posts WHERE topic_ID=$_GET[t]") OR DIE ("Error With query sql");
while ($row = mysql_fetch_array($sql)) {
   $posts[] = $row;


   $sql = mysql_query("SELECT * FROM hyperbb_members WHERE username='$row[posted_by]'") OR DIE ("Error with Second sql");
while ($row1 = mysql_fetch_array($sql)) {
   $user_info[] = $row1;


if ($row['posted_by'] == $row['username']) {
   $PAGE->MergeBlock("posts", $posts);
   $PAGE->MergeBlock("user_info", $user_info);


} elseif ($row['posted_by'] != $row['username']) {
   $PAGE->MergeBlock("posts", "$posts");
 
  $guest_array['location'] = "Guest";
  $guest_array['posts'] = "0";
  $guest_array['joined'] = "Not a Member";
  $guest_array['username'] = "$row['posted_by']";
  $guest_array['sign'] = "I am a Guest";
$PAGE->MergeBlock("user_info", $guest_array);
}}}



$PAGE->MergeField("TITLE", "Hyperbb_Post List");
$PAGE->show();


exit();
mysql_close();
?>
By: Skrol29
Date: 2003-07-22
Time: 16:50

Re: TBS Error Help

Hello,

I can't see in your code the query that the TBS error message talks about.
It should be something with WHERE (username='%p1%')

Is you eror message still the same ?
By: Mankiy
Date: 2003-07-22
Time: 19:50

Re: TBS Error Help

I dont see the error after i have redone the code.....

nut now its not merging the blocks.....