Tony Law
Forum Replies Created
-
@keraweb No problem. Yes it does seem very strange!
MySQL Version: 5.7.25
As far as I know it’s the latest version of MySql.
@keraweb Thanks for your help.
I have run this directly against the SQL database and hacked around with the query. Turns out that there are spaces in the built query which my DB version didn’t like. Removing these fixed the issue!
I amended the following params to remove the spaces between and it now works.
if($selectedCat){ $params = array( 'where' => 'workshop_category.meta_value="' . $_GET["STEMCat"] . '"', 'limit' => -1, ); } else { $params = array( 'limit' => -1, ); }@keraweb thank you. Yes, I can’t see any issue with it and I’ve tried several different itterations with no success.
The debug trace came back with:
Database Error; SQL: SELECT DISTINCT
t.* FROMvrw_postsAStLEFT JOINvrw_postmetaASworkshop_categoryONworkshop_category.meta_key= ‘workshop_category’ ANDworkshop_category.post_id=t.IDWHERE ( (workshop_category.meta_value= ‘E’ ) AND (t.post_type= “primary-workshop” ) AND (t.post_statusIN ( “publish” ) ) ) ORDER BYt.menu_order,t.post_title,t.post_date; Response: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ = ‘E’ ) AND (t.post_type= “primary-workshop” ) AND (t.post_statusI’ at line 11Adding t. before workshop_category give me an unknown coulmn error. So it looks as though I’m looking in the right place. I have tried escaping the string via \ as well as using the PHP functions to escape the strings, I have also tried string interpolation but always get this syntax error
- This reply was modified 5 years, 8 months ago by Tony Law.
It’s a plain meta value. Setup as a field in the POD:
Field Type: Relationship
Related To: Simple
Custom Defined Types: S|Science
T|Technology
E|Engineering
M|MathsIt’s a singular dropdown list and I am using the value to evaluate against the querystring (?STEMCat=x)
if it helps, my updated code is:
$selectedCat = $_GET["STEMCat"]; if($selectedCat){ $params = array( 'where' => "workshop_category.meta_value = '" . $selectedCat . "'", 'limit' => -1, ); } else { $params = array( 'limit' => -1, ); } $PWpod = pods('primary-workshop')->find($params);Thanks in advance
Hi Jory. Thanks for thre quick response. I figured this would be the case, but thought I’d check as the same concept in something like .net where the where clause would read …meta_value = ” would yield all results instead of no results.
Anyway
I have now created a page template for this and it’s running fine, until I add the where clause and then I get a SQL syntax error. If I include t. before the field name then I get an unknown column error, so I think the column name is correct and as far as I can see everything else should be fine. I have tried swicthing the ” and ‘ around as well as using ` but nothing seems to work.
My code is below:
$var = "S"; // Placeholder for the moment. Replace with querystring val when working $params = array( 'limit' => -1, 'where' => 'workshop_category.meta_value = "' . $var . '"' //Works with this line taken out ); $PWpod = pods('primary-workshop',$params); if ( $PWpod->total() > 0 ) {...This works when I take out the where clause (S is a known valid value). I’ve looked through several posts and tried several different itterations of this including with and with out the ‘t.’ and using LIKE but I still get the same error.
My shortcode this is dervied from is:
[pods name=”primary-workshop” template=”Primary Workshops” where=”workshop_category.meta_value = ‘{@get.STEMCat}'”]Please advise.
Forum: Plugins
In reply to: [Memphis Documents Library] Open PDFs in browser instead of downloadingPerfect, thank you
Forum: Plugins
In reply to: [Memphis Documents Library] Hide mdocs-posts pageThat did nothing unfortunately. I ended up writing a redirect for mdocs-posts to the main homepage
Tried on a fresh instance of Chrome and it worked, so this appears to be a caching issue with the individual browser. Looks like it’s working fine now.
I have worked on this a little more and the issue only presents on Chrome now. All other browsers are fine. I have tried clearing my cache but it has had no effect. Please advise.
Forum: Plugins
In reply to: [Simple Event Planner] Restrict search to certain fields?Ah! I had a plugin which was modifying the search! Disabled and now I can see it’s using title only.
Forum: Plugins
In reply to: [Simple Event Planner] Restrict search to certain fields?Thanks.
Thats interesting. The filter doesn’t seem to be working as it’s definitely searching on more than just the event title. I’m getting results where the search criteria appears in the body as well.
Forum: Plugins
In reply to: [Simple Event Planner] Restrict search to certain fields?Thanks for the reply.
I am a web developer, so do understand code. However, I can’t seem to find the functions that carry out the search. Can you please point me in the right direction to amend the code please.
Thanks
Forum: Plugins
In reply to: [Simple Event Planner] Fields names?Either way, my data is now in and working fine. Thank you for your help
Forum: Plugins
In reply to: [Simple Event Planner] Fields names?Thats odd. The start_date has imported correctly, however it is sowing as 1st January 1970 on the front end. If I go into the event in the admin and just click save, the correct date is then displayed.