The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
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");
Oh, also: I've created a custom template which is pulled onto a custom PHP page in my forums directory (thanks JimF! )...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! ![]() Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
Code:
$query2=$DB_site->query("SELECT * FROM savethreads WHERE saveuser='$username'");
while ($row = $DB_site->fetch_array($result)) {
$savethreadid = $row["savethreadid"];
echo("$savethreadid");
}
|
|
#3
|
|||
|
|||
|
Thanks Ed - very cool.
Anyone got any thoughts on the template problem? I'll bet the answer is simple - yet it escapes me somehow.
|
|
#4
|
|||
|
|||
|
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");
}
|
|
#5
|
|||
|
|||
|
You need to replace $result with $query2
|
|
#6
|
|||
|
|||
|
Oops, sorry 'bout that - thanks rangers.
|
|
#7
|
|||
|
|||
|
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!
|
|
#8
|
|||
|
|||
|
Hmmm...maybe I'll be forced to figure it out myself, hehe.
![]() It's okay - I can handle it! I hope!
|
|
#9
|
|||
|
|||
|
Post the code you have for your template.
|
|
#10
|
|||
|
|||
|
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>
|
![]() |
|
|