vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Help with Tempplates & SQL Queries (https://vborg.vbsupport.ru/showthread.php?t=3486)

09-27-2000 01:07 AM

I'm writing a hack (ha! If you can even call it that - I'm not that talented)...and basically, I'd like to use SQL queries in the same format as vBulletin - since that seems to be the most logical thing to do...however, I can't get it to display more than one entry...any advice? I'll obviously need a while loop, but I'm not sure how to format it...

Here's what I have (which produces an error):

Code:

$query2=$DB_site->query_first("SELECT * FROM savethreads WHERE saveuser='$username'");
$result = mysql_query($query2,$DB_site);
while ($row = mysql_fetch_array($result)) {
        $savethreadid = $row["savethreadid"];
echo("$savethreadid");

Any thoughts?

Oh, also: I've created a custom template which is pulled onto a custom PHP page in my forums directory (thanks JimF! :D)...however the template displays first, with all my queries and their results below it all - how can I stick it in the middle of the template? I don't recall seeing actual queries used in any of the other templates...so I know there must be some other way.

Thanks! :)

09-27-2000 01:25 AM

Code:

$query2=$DB_site->query("SELECT * FROM savethreads WHERE saveuser='$username'");
while ($row = $DB_site->fetch_array($result)) {
        $savethreadid = $row["savethreadid"];
echo("$savethreadid");
}


09-27-2000 10:01 PM

Thanks Ed - very cool.

Anyone got any thoughts on the template problem? I'll bet the answer is simple - yet it escapes me somehow. :)

09-27-2000 10:07 PM

Uh...the other thing still doesn't work I'm afraid:

Warning: Supplied argument is not a valid MySQL result resource in /usr/home/webdev/mycoding/spunkyjunk.com/docs/testboard/admin/db_mysql.php on line 82

Using this code:

Code:

$query2=$DB_site->query("SELECT * FROM savethreads WHERE saveuser='$username'");
while ($row = $DB_site->fetch_array($result)) {
        $savethreadid = $row["savethreadid"];
echo("$savethreadid");
}


09-27-2000 10:28 PM

You need to replace $result with $query2

09-28-2000 12:11 AM

Oops, sorry 'bout that - thanks rangers.

09-28-2000 12:25 AM

Bingo! My mistake - still have a bit to learn about PHP's interaction with SQL (obviously) :)

Anyone else got the info on my template problem? It's one of the last hurdles in finishing the hack! :D

09-28-2000 10:51 AM

Hmmm...maybe I'll be forced to figure it out myself, hehe. :)

It's okay - I can handle it! I hope! :)

09-28-2000 01:56 PM

Post the code you have for your template.

09-28-2000 02:42 PM

Here's a new template I've created for one of the pages used in my hack:

Code:

{htmldoctype}
<HTML>
<HEAD><TITLE>$pagetitle</title>
$cssinclude
$headinsert
</head>
<body>
$header

<table border="0" width="100%"><tr>
<td valign="top" align="left"><a href="index.php"><img src="$titleimage" border="0"></a></td>

<td valign="middle" align="center" nowrap>
$fivelinks
</td></tr></table>

<table border=0 cellpadding=4 cellspacing=1 width=100%>
<tr bgcolor="{tableheadbgcolor}"><TD width="100%">

<normalfont color="{tableheadtextcolor}" class=thtcolor><B>vBulletin Message</B></normalfont>

</td></tr>
<tr bgcolor="{firstaltcolor}"><td width="100%">
WANT STUFF TO GO RIGHT HERE!</td></tr></table>

<p align="center">$forumjump</p>

$footer

</body>
</html>

Obviously I want to put all my SQL queries and echo statements right where "WANT STUFF TO GO RIGHT HERE!" is...but how can I do that in the template? For the other templates on the script I see variables in that spot...$errormessage, or the like. I have an idea of how to do this, but definetly need some help! :)


All times are GMT. The time now is 12:49 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.00962 seconds
  • Memory Usage 1,741KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete