The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
RESOLVED Does this Query have a chance?
Not only am I pretty new to writing my own PHP code, I'm even newer at writing my own SQL queries and even newer at writing anything for vBulletin, if that makes sense...
I'm JUST starting a vBa CMPS page for a friend of mine's site and before I get too far into this, I'd like to know if this query has a chance of working, given that all of the tables and other variables are correct... PHP Code:
Remember, I'm just a noob at this, so if I've done something horribly wrong in my code, I'm simply just not aware of what you can and cannot do in SQL queries yet. (or PHP, apparently) Oh, and also, this is the second query on this page. Is it possible to combine two queries if one of them contains the results of the other? (See code above) Thanks! [EDIT] Realized I needed to change a couple things. [/EDIT] --------------- Added 31 Dec 2008 at 05:38 --------------- I'm learning that I have a LOT to learn... Never mind...I figured out the query I need to run, but I'm having problems with the rest of my script... |
#2
|
||||
|
||||
PHP Code:
|
#3
|
|||
|
|||
Thank you so much. That just shortened everything quite nicely.
Now I'm just having issues with everything else. I'm desperately trying to learn PHP and vBulletin functions all at the same time in as little time as possible. Kinda messing me up here... Sorry for being such a (n OR b)oob. --------------- Added [DATE]1230731403[/DATE] at [TIME]1230731403[/TIME] --------------- Okay, I've figured most of it out now (yes, I've been searching, not just asking ), but I'm coming across a problem (My fault, I'm sure. I'm not afraid to say that I know almost nothing here). In my database I've entered bogus "menus" and "planners". With: PHP Code:
How do I get an array with all results? (Please don't shoot me ) Maybe I should mention that I changed my code a little, so the whole implode() function wasn't necessary. $menuids was already "1,2,3,4". |
#4
|
||||
|
||||
Probably something more along these lines:
PHP Code:
|
#5
|
||||
|
||||
This is what you want:
PHP Code:
|
#6
|
|||
|
|||
Thanks.
I was able to get sort of the results that I want, but now the problem is that I need to have them sorted in the order that is called for in $menuids. For example, $menuids is supposed to be "5,10,3,1,4,7", but it's returning the results in numerical order ASC. I've tried using array_multisort(), but one of the arrays is a multi-dimensional array, and one is not, so it's not working...in other words, I've turned the data in $menuids into an array and tried sorting $menus_array with it. Nope. Didn't work... I'm just taking stabs in the dark here. If I should post my script code, I will. Thank you all for your assistance. |
#7
|
||||
|
||||
MySQL will automatically sort by the primary key if no order clause is specified in a query. Dirty way is below, I can't think of anything else off the top of my head.
PHP Code:
|
#8
|
|||
|
|||
Thank you.
Now the problem I'm having is how to actually call the [shortdescription] from my query with this information. Grrr...I really should know how to do this, but I'm just not getting it. I admit, I haven't gone through learning PHP from the beginning, but instead I just dive right in and seemingly waste people's time. But, with this new info, how would I call the [shortdescription] for each table cell that I'm putting these in? Here's some context: PHP Code:
http://www.whatz4dinner.com/portal.php?pageid=planner (I know you can't see the results, but this is the format) Thank you so much for helping me with this. |
#9
|
||||
|
||||
I don't see why you needed to results in any specific order. Replace what I posted before with this:
PHP Code:
PHP Code:
|
#10
|
|||
|
|||
The reason is because of the way I have the table filled. It's a vertical loop of sorts, but I guess I could just reorder [menuids] and fill the table horizontally.
Thank you so much for your help. I'll go in and see what I can do. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|