Quote:
Originally Posted by Lynne
I would use fetch_array in case you to later have multiple rows and you should specify the field you want. Assuming you want history.field, then:
PHP Code:
$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "history");
$l_history['field'] = '';
while ($l_history = $db->fetch_array($result)){
$history['field'] .= $l_history['field'];
}
and then in the template:
HTML Code:
{vb:raw history.field}
|
Lynne, I do appreciate your valued input.
I tried to make it work but I produced db errors in the process.
Info: I have one row now, but I anticipate in the future many rows, each one containing 7 columns. And in this routine I wish to list on my page all the rows.
So this is what I did with your suggestion....
Code:
$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "history");
$l_history['field'] = '';
while ($l_history = $db->fetch_array($result)){
$history['datefield','field1','field2','field3','field4','field5','field6'] .= $l_history['datefield','field1','field2','field3','field4','field5','field6'];
}
with the variable registered as stated.
But this doesnt work nicely with sql.
My apologies for being not so sql inclined, and I dont wish to burdon you with 'teaching' me how to make this work, but I am not so skilled at database manipulation.
(I am hoping to learn how to make this work so I wont be such a bother in the future)
--------------- Added [DATE]1381977398[/DATE] at [TIME]1381977398[/TIME] ---------------
I have decided I am going to do a crash course on sql. I need to be able to do more than hope someone here can hold my hand making something that would otherwise add several pages in this thread. The above responces have indeed helped me, but what I am trying to create is going to be propietary to my website, and I am stumped on just the first section of it out of several. It is my responsibility to educate myself so my questions remain more attached to the subject.
Lynne, you have been a great help especially with this tutorial.
This is in fact an amazing addition to anyone that wishes to do custom pages using templates, php, etc, on a forum setup.
Thanks again.