Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1200291

    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?

    #1201316

    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

    #1201389

    So WordPress & Enfold don’t support the word “AND” in sql_query?

    #1201771

    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

    #1202177

    Hi Ismael,
    misano_services is a database table that I created manually

    #1202567

    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

    #1203337

    Hi Ismael,
    I’m sorry, I didn’t see you first question. However I resolved my problem with nested query. Thanks anyway.

    #1203624

    Hi paoluccimarketing,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘SQL Query Problems’ is closed to new replies.