By: Radeon
Date: 2004-09-22
Time: 19:13
|
Merge Error
I'm having some problems with merging data from the database with my html files.
This is what i have:
function newsEdit($id) {
global $db;
$query = "SELECT * FROM site_news WHERE news_id='$id'";
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('html/admin_news_edit.html');
$TBS->MergeBlock('nws', $db, $query);
$TBS->Show();
}
|
But all i get when merging with the html is:
TinyButStrong Error (Array value): Can't merge [nws.news_title] because there is no key named 'news_title'. This message can be cancelled using parameter 'noerr'.
TinyButStrong Error (Array value): Can't merge [nws.news_content] because there is no key named 'news_content'. This message can be cancelled using parameter 'noerr'.
And i know that these does exist so i don't get what the problem is!
I also have this problems with some other scripts that i've written, they just came up from nowhere. Could there be a problem with my php or apache installation? I have some pages where the merging works, but it doesn't on some....
|
By: Skrol29
Date: 2004-09-22
Time: 19:27
|
Re: Merge Error
Hello,
Are there other TBS fields for this block?
Did you take care of string case (lower/upper)?
Did you tried to check your records using var_export() for example?
What is you database type? Or your connectivity tool?
What is your TBS version?
Do you use database custom functions?
|
By: Skrol29
Date: 2004-09-22
Time: 19:31
|
Re: Merge Error
Are those fields inside the block or outside?
|
By: Radeon
Date: 2004-09-22
Time: 19:46
|
Re: Merge Error
I'm using version 1.97.
Everything is lower case.
I'm using mysql database, to manage it i use phpmyadmin.
And i don't use any other database functions than the ones needed to get TBS to connect to the database.
The thing is that i have done ecaxtly the same way with another html page and it works there....
This is the html (i had removed the news_id, but i just put it back in):
<tr><td><table background="images/block_big_fill.gif" cellpadding="4" cellspacing="0" width="408" class="table_01">
<form method="post" action="?action=update&id=[edt.news_id]">
<tr><td class="text_02" valign="middle" width="50">Title</td><td>
<input class="box" size="60" type="text" name="nws_title" value="[edt.news_title]" /></td></tr>
<tr><td class="text_02" valign="top" width="50">Content</td><td>
<textarea class="box" cols="57" rows="10" name="nws_content" />[edt.news_content]</textarea></td></tr>
<tr><td></td><td><input type="submit" class="button" value="Insert News" /></td></tr>
</form>
</table></td></tr>
|
|
By: Skrol29
Date: 2004-09-23
Time: 01:31
|
Re: Merge Error
Hi Radeon,
When you merge data with a block that have no block definition in the template, then all fields of the block are merged with the first record of the data. (This is a special behavior decribed in the manual)
But when you merge such a block with a query that returns no data, then each fields of the block brings an error.
You can cancel the error messages using parameter 'noerr'.
|
By: Radeon
Date: 2004-09-23
Time: 08:44
|
Re: Merge Error
But there should be data in the table and i know that there is data. The thing is that some weeks ago i did the exactly same thing but lately it won't work anymore like it did....
|
By: Radeon
Date: 2004-09-23
Time: 08:52
|
Re: Merge Error
Seams like i fixed it, i were having a problem with the fetcing of the ID. Seams like it dodn't want to get the id when i did like "function newsEdit($id)" So i just did a "$id = $_GET['id'];" :P
|
|
Posting in progress.
Please wait...
|