![]() |
trouble with forumdisplay.php
I hope someone can help me. I am trying to to figure out a way to pull a variable from a table seoperate from the threads table and have a value show in the forumdisplaybit. I try to place a query right after this code in forumdisplay.php
PHP Code:
but it doesn't seem to get the info from the DB is there i think i am placing this code incorrectly hope i explained this well enough and that someone can help me Thnaks in advance jsell |
What is the variable and how are you writing the query line? Post exactly what you put down and where in forumdisplay.
|
the query i used is
PHP Code:
this should return a variable i want to return is $reqdata[status] a 1 or 0 to signify a yes or no which will the each open there own template to place into the forumdisplaybit and appear on nt appear based on the variable (i think that makes sense....lol) but i get novalue at all for any variable eventhough the data is there in the database --jsell |
you know it's not good to have a query within a whileloop?
you should use a join-query instead. nevertheless i think your where clause is wrong use this: PHP Code:
|
well I fixed the problem with the variable, but now you have me intrigued as i am aparently not doing the correct way. If someone would kindly expalin to me how the join-Query Xenon is refering to should work I would like to know.
Thanks in advance --jsell |
well, somewhere in your script you define the $threads variable:
Code:
$threads=$DB_site->query("SELECT * FROM thread WHERE ... Code:
$threads=$DB_site->query("SELECT thread.*,reqdata.* FROM thread LEFT JOIN reqdata USING(threadid) WHERE ... |
Thanks Again Xenon!!
A quick reply too :). it's not an issue in this particular case but for future reference I can see how this could cause one problem though if there are identically named fields in the two different tables then there would be a conflict is there a way around this?? --jsell |
you're welcome :)
if you have fields with identical names you shouldn't use the * use explicit names instead: Code:
$threads=$DB_site->query("SELECT thread.threadid, thread.title,reqdata.title AS reqtitle FROM thread LEFT JOIN reqdata USING(threadid) WHERE ... you can use the AS operator whenever you have two fields with same names to rename on of them |
I See Now!! Thank you again for all you help
--jsell |
welcome :)
that's why i'm here. if you have other questions, feel free to post, there are many people out which can help :) |
How would I make a Query to pull just the ReplyCount, The Thread Title, and then link it to the thread id?
Ive tried loads of queries, but i cant get it to work... Could those queries be adapted? If so, would you mind telling how? Satan |
PHP Code:
|
Cool thanks:)
You wouldnt happen to know how I could get that to display in a table would you? Satan |
Basicly have this PHP and then two templates, the bit, for each result and the mainone to house them all:
PHP Code:
|
Thanks:)
Satan |
it doesn't work right i'm sure i'm doing something wrong
here is what i changed the $threads Query to PHP Code:
PHP Code:
PHP Code:
any idea Thanks --jsell |
Thats because it would be :
PHP Code:
Try that code, and $thread[reqfiller];) Satan |
Thanks i think my brain is fried
--jsell |
LOL! I see that you're getting support from the pros here. :) Sorry I didn't get back to this thread sooner, but it looks like things are under control.
|
:)
you're welcome jsell @Erwin: That thread is a good example: So sees a problem and many users jump to it and try to solve ;) |
All times are GMT. The time now is 04:02 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|