Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. Independent Developers
  4. SQL AND and OR operators
QtWS25 Last Chance

SQL AND and OR operators

Scheduled Pinned Locked Moved Unsolved Independent Developers
phpsqloperatorsforum website
3 Posts 3 Posters 821 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Lucky01L Offline
    Lucky01L Offline
    Lucky01
    wrote on last edited by
    #1

    Simply put, I want to know if you can utilize both of them in a PHP code. I had the following idea:

    $sql2 = mysql_query("SELECT * FROM forum WHERE id='$topicsnumber' AND main='0' OR main='1' OR main='2'");   
    while($row=mysql_fetch_array($sql2)) {code in here}
    

    Where id='$topicsnumber' AND (main='0' OR main='1' OR main='2') is the condition under which it is checked. Can this be done? I have referred to this article

    jsulmJ JonBJ 2 Replies Last reply
    0
    • Lucky01L Lucky01

      Simply put, I want to know if you can utilize both of them in a PHP code. I had the following idea:

      $sql2 = mysql_query("SELECT * FROM forum WHERE id='$topicsnumber' AND main='0' OR main='1' OR main='2'");   
      while($row=mysql_fetch_array($sql2)) {code in here}
      

      Where id='$topicsnumber' AND (main='0' OR main='1' OR main='2') is the condition under which it is checked. Can this be done? I have referred to this article

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Lucky01 This is Qt forum, not PHP

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • Lucky01L Lucky01

        Simply put, I want to know if you can utilize both of them in a PHP code. I had the following idea:

        $sql2 = mysql_query("SELECT * FROM forum WHERE id='$topicsnumber' AND main='0' OR main='1' OR main='2'");   
        while($row=mysql_fetch_array($sql2)) {code in here}
        

        Where id='$topicsnumber' AND (main='0' OR main='1' OR main='2') is the condition under which it is checked. Can this be done? I have referred to this article

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @Lucky01
        So far you have asked about Laravel and SQL in PHP. Why do you want to use this forum if you are using them and not Qt? Beats me.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved