...

View Full Version : using True/False code



jdimino
03-27-2009, 04:41 PM
Hi everyone

I need your help!! I would like to add a True/False code
if true is found in "approve field it should go and output all data in the table form
If false is found no data should show on the table data but a text string saying "Registration Pending"
thanks hope its clear


<?PHP

$link = mysql_connect('localhost', 'root', 'jdXXX');
if (!$link) { die('Could not connect: ' . mysql_error()); }
mysql_select_db('reg');

// Fetch total number of records
$result = mysql_query("SELECT COUNT(*) AS recordCount FROM ihsreg");
$row = mysql_fetch_assoc($result);
$recordCount = $row['recordCount'];


// Perform Search
$results = array();
if(isset($_REQUEST['search'])){

$limit = 20;
if($_GET['offset']){ $offset = $_GET['offset']; } else { $offset = 0; }

$SQL = "SELECT * FROM ihsreg ";

//$term = strtoupper(addslashes($_REQUEST['search']));
$term = strtoupper($_REQUEST['search']);
if(stristr($term,"'") && !stristr($term,"\'")){
$term = addslashes($term);
}

if($_REQUEST['radiobutton']){
switch($_REQUEST['radiobutton']){
case '1': $SQL.=" WHERE Bloom_Name LIKE \"$term\""; break;
case '2': $SQL.=" WHERE Pod_Name LIKE \"$term\""; break;
case '3': $SQL.=" WHERE Pollen_Name LIKE \"$term\""; break;
case '4': $SQL.=" WHERE Hybridiser LIKE \"$term\""; break;
case '5': $SQL.=" WHERE Origin LIKE \"$term\""; break;
case '6': $SQL.=" WHERE Grower LIKE \"$term\""; break;
case '7': $SQL.=" WHERE Color_Group LIKE \"$term\""; break;
case '8': $SQL.=" WHERE Bloom_Type LIKE \"$term\""; break;
case '9': $SQL.=" WHERE Reg_Mini LIKE \"$term\""; break;
case '10': $SQL.=" WHERE Size_Range LIKE \"$term\""; break;
case '11': $SQL.=" WHERE Propagation LIKE \"$term\""; break;
case '12': $SQL.=" WHERE Bloom_Color LIKE \"$term\""; break;
case '13': $SQL.=" WHERE Bloom_Characteristics LIKE \"$term\""; break;
case '14': $SQL.=" WHERE Leaf_Characteristics LIKE \"$term\""; break;
case '15': $SQL.=" WHERE Bush_Characteristics LIKE \"$term\""; break;
case '24': $SQL.=" WHERE Cross_Made LIKE \"$term\""; break;
case '25': $SQL.=" WHERE date LIKE \"$term\""; break;
default: $SQL.=" WHERE Bloom_Name LIKE \"$term\""; break;
} // switch
} else {
// If they didnt' select a radio button...
$SQL.=" WHERE Bloom_Name LIKE \"$term\"";
}

$result = mysql_query($SQL);
$resultCount = mysql_num_rows($result);

$SQL.= " LIMIT $offset, $limit";

$result = mysql_query($SQL);

if($resultCount > 0){
while($row = mysql_fetch_assoc($result)){
$results[$row['id']] = $row;
} // while
} // if there are results
} // if user performed a search
?>

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html">
<script type="text/javascript">
<!--
function show_remote(imageSrc){
//OpenWindow = window.open("index1.php?Search_box="+imageSrc.split('.')[0], "remoteWin", "resizable=1, scrollbars=1, toolbar=0, left=15, top=10, width=290, height=320");
document.location = 'index1.php?Search_box='+imageSrc.split('.')[0];
/*
OpenWindow.document.write('<img width="250" height="250" src="'+imageSrc+'"><br>');
OpenWindow.document.write('<div align="center"><strong>'+imageSrc.split('.')[0]+'</strong><br>');
OpenWindow.document.write('<a href="javascript:window.close();">Close Window</a></div>');
*/

}

function change_search_value(val){
document.forms["cv"].elements["search"].value = val;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<style type="text/css">
td.detail {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
}
td.caption {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
text-align: center;
}
</style>
</HEAD>
<BODY bgcolor="#FFFFFF">
<div align="center"><FONT COLOR="#000000"><IMG SRC="images/SEtitle.jpg" WIDTH="500" HEIGHT="75"></FONT>
</div>
<table width="100%" border="0" cellspacing="2" cellpadding="2" BGCOLOR="#FFFFFF">
<tr valign="top">

<td height="79">
<div align="left">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b>To search
for a Registered cultivar, you have two options, one is to type-in name
and click on search, or use "Cultivars Name" drop menu link. If you
choose the drop menu, make your selection first and then click on the
search button. (make sure you select the radio button just before" Cultivars
Name") To search by either Mother, or Father, select radio button just
before "Mother" or " Father" type-in name or select from drop menu,
this will show you how many times a cultivar has been used as a Mother
or Father. To see all crosses made up to date, click on "Select Cross"
link. If you like to see the results of that particular cross, select
from drop menu list. and then click on search. (don't forget radio button)
For all other fields (Hybridizer, Origin, Grower, Color, Size, Bloom
Type…..) select the radio button, and standard filters from the related
drop down menu list. <br>
1) To search for an exact Word: type-in name 2) To search a partial
name, you must use a jolly % sign at the end (example) Lady C% 3) To
list all registered CV's, type-in % 4) To list CV's alphabetically,
type-in: A% or B% etc.. 5) For an exact word between a paragraph use jolly in front and back. %name or word%
</b></font></div>
</td></tr>
</table><div align="center"><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span> <font color="#000000"><u1:p></u1:p><u1:p></u1:p><u1:p></u1:p></font>

<TABLE WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
<TR>
<TD HEIGHT="2" colspan="3">
<DIV ALIGN="center"><SPAN STYLE='font-size:12.0pt;mso-bidi-font-size:
18.0pt'><FONT COLOR="#009900" SIZE="3" FACE="Trebuchet MS"><STRONG><font color="#000000" size="1"><b><font size="2"><a href="http://localhost/SEArchive/index/" target="_parent"><font size="1">Home
Page</font></a></font></b> |<a href="http://localhost/SEArchive/SEindex1.php" target="_parent">CV
Search Engine</a> |<a href="index1.php" target="_parent">Genealogy Tree</a>
|<a href="http://localhost/CVsinglepage/index1.php" target="_parent">Multiple
CV Page</a></font></STRONG></FONT></SPAN></DIV>
</TD>
</TR>

<TR>
<TD HEIGHT="2" width="37%">
<div align="center"><font color="#000000"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font color="#000000"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font color="#000000"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font size="1"><?php echo gmdate("M d Y");
?></font></b></font></font></b></font></font><font size="1">&nbsp;</font></b></font></font></div>
</TD>

<TD HEIGHT="2" width="27%">
<div align="center"><font color="#000000"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font color="#000000"><font color="#000000"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font size="1"><?php echo number_format($recordCount); ?>
records </font><font face="Arial, Helvetica, sans-serif" size="2"><b></b></font></b></font></font><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b></b></font></font></b></font></font></div>
</TD>

<TD HEIGHT="2" width="36%">
<div align="center"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Total
Results found: <?php echo $resultCount; ?> </font><font face="Arial, Helvetica, sans-serif" size="2"></font></b></div>
</TD>
</TR>
</TABLE>

abduraooft
03-27-2009, 04:51 PM
Please wrap PHP codes using the
tag (http://www.codingforums.com/showthread.php?t=68462) and format client side code in your posts using the
][/COLOR] tag! (http://www.codingforums.com/showthread.php?t=82672)

Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum