View Single Post
  #1011  
Old 10-16-2013, 02:50 AM
smirkley smirkley is offline
 
Join Date: Apr 2008
Posts: 627
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01195 seconds
  • Memory Usage 1,785KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete