![]() |
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 :) |
All times are GMT. The time now is 06:49 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:
|