0

I have a query that works fine when I run it in PHPMyAdmin, but does not return anything when ran via the website form post.

I copy and paste the exact SELECT below, replace both$searchByText and $custid with values (which echo just fine on the page itself after doing a post, so I know it's passing the right values), into PHPMyAdmin and it works great.

So I'm guessing the way that wpdb function is preparing the query must mess something up with my LIKE wildcard? I haven't had success searching around for that though. Any ideas?

$journalResult = $wpdb->get_results
(
   "SELECT a.trackerid, a.daterecorded, b.moondesc, a.dailyenergy, 
   a.dailyintensity, a.am, a.pm, a.preenergy, a.postenergy, a.menstcycle, 
   a.journalentry FROM personaltracker a
   LEFT JOIN mooncenter b ON a.moonid = b.moonid
   WHERE a.journalentry LIKE '%$searchByText%' AND a.custid='$custid'
   ORDER BY daterecorded ASC"
);     

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.