Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    list only what is false

    Hi

    Can someone tell me how to list only what is false for field "Bloom_Name" instead of all.
    Thanks


    <?PHP
    mysql_connect("localhost", "ixxx_xxx", "jxxx") or die(mysql_error());
    mysql_select_db("ixxxx_rxxx") or die(mysql_error());
    $sql = "SELECT * FROM `ihsreg` ORDER BY `Bloom_Name` ASC";
    if (!(@ $result = mysql_query($sql))) {
    print "There was an error running your query:<p>\n". $sql . "<p>\n";
    }

    print '<select name="Bloom_Name"
    onchange="Search_box.value=this.options[this.selectedIndex].text"><br>\n';
    print '<option value="#"> Choose One ';


    while ($row = mysql_fetch_row($result)) {
    $id = $row[0];
    $Bloom_Name = $row[3];

    print "<option value=\"$id\"";
    if ($_REQUEST["Bloom_Name"] == $id) { print " selected"; }

    print "> $Bloom_Name <br>\n";
    }
    print '</select>';

    ?>

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    Use the "where" clause in the MySQL e.g. "SELECT * FROM `ihsreg` WHERE Bloom_Name!='false' ORDER BY `Bloom_Name` ASC" now if it's 0 and 1 you'll have to change it.. or something like that probably wrong tho
    Last edited by Iszak; 08-07-2008 at 11:10 AM.

  • #3
    New Coder
    Join Date
    Dec 2005
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've tried, but it continues to list all values.

    <?PHP
    mysql_connect("localhost", "xxxx_xxxx", "xxxx") or die(mysql_error());
    mysql_select_db("xxxx_xxxx") or die(mysql_error());
    $sql = "SELECT * FROM `ihsreg` WHERE Bloom_Name!='false' ORDER BY `Bloom_Name` ASC";
    if (!(@ $result = mysql_query($sql))) {
    print "There was an error running your query:<p>\n". $sql . "<p>\n";
    }

    print '<select name="Bloom_Name"
    onchange="Search_box.value=this.options[this.selectedIndex].text"><br>\n';
    print '<option value="#"> Choose One ';


    while ($row = mysql_fetch_row($result)) {
    $id = $row[1];
    $Bloom_Name = $row[3];

    print "<option value=\"$id\"";
    if ($_REQUEST["Bloom_Name"] == $id) { print " selected"; }

    print "> $Bloom_Name <br>\n";
    }
    print '</select>';

    ?>

  • #4
    Regular Coder
    Join Date
    May 2008
    Location
    Ohio
    Posts
    231
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Are the values in that column that you're avoiding equal to the string 'false'? Or do you mean "false" as in "it's not set" or "it's null" - because there's a big difference. If you have phpmyadmin, browse the table and find whether it's NULL, an empty string, or a string "false" (or something else).
    zok@zoklet:~$ whereis zok
    zok: http://zoklet.net | http://zoklet.net/otg | /derzok/at/gmail/dot/com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •