vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Simple query question ? (https://vborg.vbsupport.ru/showthread.php?t=46885)

fla5h 12-21-2002 07:28 PM

Simple query question ?
 
If I wanted to return the thread starters userid what would I use ?


I used

PHP Code:

$firstpostinfo=$DB_site->query_first("SELECT userid FROM post WHERE threadid='$threadid' ORDER BY dateline LIMIT 1"); 

in showthread.php

but it didn't work ?

Is the code wrong, or shouldn't it be in showthread ?

Thanks

Fla5h

NTLDR 12-21-2002 07:32 PM

Where are you trying to put this and where do you want it to appear?

fla5h 12-21-2002 07:55 PM

I'm putting this in showthread.php

just after

PHP Code:

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) { 

I want it to return the userid so I can test it against the userid opening the thread.

Like on here where we have the titles big at the top, I want a different template showing to the normal member than the member that posted the thread.

Got the template location etc sorted, just cannot get the condition statement working

PHP Code:

         if ($firstpostinfo==$bbuserinfo[userid]) { 

                    eval(
"\$threadheader = \"".gettemplate("showthread_member_header")."\";");

              } else {

             eval(
"\$threadheader = \"".gettemplate("showthread_poster_header")."\";");

      } 

So am wondering if the first query is correct ?

Is there a way of debugging php etc, say a step through the code line by line ?

Thanks

Fla5h

NTLDR 12-21-2002 08:05 PM

The query for getting the userid of the thread starter is:

PHP Code:

$starter $DB_site->query_first("SELECT postuserid FROM thread WHERE threadid='$threadid'"); 

And then use $starter[postuserid] to access the userid for the thread starter.

fla5h 12-21-2002 08:43 PM

Stunning m8

thanks a lot, that worked a treat.

gmarik 03-02-2004 06:35 PM

How is this made? http://www.thesistersthree.com/showe...=6#episode6x16

Chris M 03-02-2004 06:41 PM

Quote:

Originally Posted by gmarik

Using PHP & MySQL ;)

Satan

NTLDR 03-02-2004 06:41 PM

Quote:

Originally Posted by gmarik

Not that it has anything to do with this thread, but it was written by me for TS3.


All times are GMT. The time now is 06:13 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02232 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete