...

View Full Version : list only what is false



jdimino
08-07-2008, 11:40 AM
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>';

?>

Iszak
08-07-2008, 12:04 PM
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

jdimino
08-07-2008, 03:45 PM
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>';

?>

derzok
08-07-2008, 03:48 PM
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).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum