I have a problem with my queries. If I add ‘AND’ to concatenate more WHERE clauses my page doesn’t work anymore.
Here an example:
$services= $wpdb->get_results("SELECT * FROM wp_misano_services AS s INNER JOIN wp_misano_places ON s.id_place = wp_misano_places.id WHERE s.id_language=$language AND wp_misano_places.name=$test_name");
foreach($servicesas $example){
echo $example->services1; //this doesn't work
}
$services= $wpdb->get_results("SELECT * FROM wp_misano_services AS s INNER JOIN wp_misano_places ON s.id_place = wp_misano_places.id WHERE s.id_language=$language ");
foreach($servicesas $example){
echo $example->services1; //this works but gives me too many results
}
How can I resolve my problem?
Hey paoluccimarketing,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
Victoria
So WordPress & Enfold don’t support the word “AND” in sql_query?
Hi,
What is the usual value assigned to the $test_name variable?
AND wp_misano_places.name=$test_name");
Is misano_services a custom post type or a database table that you created manually?
Best regards,
Ismael
Hi Ismael,
misano_services is a database table that I created manually
Hey!
We would like to ask the following question again. What is the value assigned to the $test_name variable?
AND wp_misano_places.name=$test_name");
Best regards,
Ismael
Hi Ismael,
I’m sorry, I didn’t see you first question. However I resolved my problem with nested query. Thanks anyway.
Hi paoluccimarketing,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria