Jump to content

bigbenbuilders

Members
  • Posts

    76
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bigbenbuilders's Achievements

Member

Member (2/5)

0

Reputation

  1. okay this populates the drop down but how would I have it display the categories on the page without having to click a submit button...kind of like a jump menu? <?php require_once('../Connections/cuaa_scholarships.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_cuaa_scholarships, $cuaa_scholarships); $query_Recordset1 = "SELECT DISTINCT financial.Scholarship_group FROM financial order by financial.Scholarship_group ASC"; $Recordset1 = mysql_query($query_Recordset1, $cuaa_scholarships) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?><form name="form1" method="post" action=""> <label for="select"></label> <select name="select" id="select"> <?php do { ?> <option value="<?php echo $row_Recordset1['Scholarship_group']?>"><?php echo $row_Recordset1['Scholarship_group']?></option> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); $rows = mysql_num_rows($Recordset1); if($rows > 0) { mysql_data_seek($Recordset1, 0); $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?> </select> </form> <?php mysql_free_result($Recordset1); ?>
  2. Hi guys here is the code that I am using for a search of the database which produces the results perfect. What I need to know is how to implement a drop down list or jump list that say for example produces $Scholarship_group list and when selected it only selects those particular rows. But still need the search button. Guess what I am trying to say if someone want to display everything that is fine but then have a drop down to display certain categories? Hope this makes sense. <form name="form" action="<?php echo $PHP_SELF ?>" method="get"> <input type="text" name="q" /> <input type="submit" name="Submit" value="Search" /> </form> <?php // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter mysql_connect("","",""); //(host, username, password) mysql_select_db("") or die("Unable to select database"); $query = "select * from financial where Name like \"%$trimmed%\" order by id"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); $s = $_GET['s'] ; if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; } if (empty($s)) { $s=0; } $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); echo "<p>You searched for: "" . $var . ""</p>"; $count = 1 + $s; while ($row= mysql_fetch_array($result)) { $title = $row["Name"]; $Scholarship_group = $row["Scholarship_group"]; $Selection_Criterion = $row["Selection_Criterion"]; $Application_Required = $row["Application_Required"]; $Awarded_Committee = $row["Awarded_Committee"]; $Renewable = $row["Renewable"]; $Need_Based = $row["Need_Based"]; $Tuition_Restricted = $row["Tuition_Restricted"]; $GPA_Required = $row["GPA_Required"]; $Class_Level = $row["Class_Level"]; $major_minor_requirement = $row["major_minor_requirement"]; $extracurricular_requirement = $row["extracurricular_requirement"]; $ACT_Score = $row["ACT_Score"]; $SAT_Score = $row["SAT_Score"]; $Religion = $row["Religion"]; $gender = $row["gender"]; $geographic_region = $row["geographic_region"]; $zipcode_range = $row["zipcode_range"]; $Diversity = $row["Diversity"]; echo "$count.) <strong>$title</strong> <br><br> " ; ?> <span class="style3"> <? echo "<strong>Scholarship Info:--></strong>"; echo " "; if(empty($row['Scholarship_group'])){ //empty() returned true : so there is nothing echo 'Scholarship group - None'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Scholarship Group - $Scholarship_group"; } echo " | "; if(empty($row['Selection_Criterion'])){ //empty() returned true : so there is nothing echo 'Selection Criterion - None'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Selection Criterion - $Selection_Criterion"; } echo " | "; if(empty($row['Application_Required'])){ //empty() returned true : so there is nothing echo 'Application Required - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Application Required - $Application_Required"; } echo " | "; if(empty($row['Awarded_Committee'])){ //empty() returned true : so there is nothing echo 'Awarded Committee - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Awarded Committee - $Awarded_Committee"; } echo " | "; if(empty($row['Renewable'])){ //empty() returned true : so there is nothing echo 'Renewable - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Renewable - $Renewable"; } echo "<br><br>"; echo "<strong>Award Criteria:--> </strong>"; if(empty($row['Need_Based'])){ //empty() returned true : so there is nothing echo 'Need_Based - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Need Based - $Need_Based"; } echo " | "; if(empty($row['Need_Based'])){ //empty() returned true : so there is nothing echo 'Tuition Restricted - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Tuition Restricted - $Tuition_Restricted"; } echo " | "; if(empty($row['Need_Based'])){ //empty() returned true : so there is nothing echo 'GPA Required - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Minimum GPA Required - $GPA_Required"; } echo " | "; if(empty($row['Class_Level'])){ //empty() returned true : so there is nothing echo 'Class Level - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Class Level - $Class_Level"; } echo " | "; if(empty($row['major_minor_requirement'])){ //empty() returned true : so there is nothing echo 'major/minor academic requirement - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "major/minor academic requirement - $major_minor_requirement"; } echo " | "; if(empty($row['extracurricular_requirement'])){ //empty() returned true : so there is nothing echo 'extracurricular requirement - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "extracurricular requirement - $extracurricular_requirement"; } echo " | "; if(empty($row['ACT_Score'])){ //empty() returned true : so there is nothing echo 'ACT Score - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "ACT Score - $ACT_Score"; } echo " | "; if(empty($row['SAT_Score'])){ //empty() returned true : so there is nothing echo 'SAT Score - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "SAT Score - $SAT_Score"; } echo "<br><br>"; echo "<strong>Personal Info:--> </strong>"; if(empty($row['Religion'])){ //empty() returned true : so there is nothing echo 'Religion - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Religion - $Religion"; } echo " | "; if(empty($row['gender'])){ //empty() returned true : so there is nothing echo 'gender - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "gender - $gender"; } echo " | "; if(empty($row['geographic_region'])){ //empty() returned true : so there is nothing echo 'geographic region - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "geographic region - $geographic_region"; } echo " | "; if(empty($row['zipcode_range'])){ //empty() returned true : so there is nothing echo 'zipcode range - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "zipcode range - $zipcode_range"; } echo " | "; if(empty($row['Diversity'])){ //empty() returned true : so there is nothing echo 'Diversity - No'; }else{ //empty() returned false so it is NOT true that there is nothing //so we can print it out: echo "Diversity - $Diversity"; } ?></span> <? echo "<br><br>"; $count++ ; } $currPage = (($s/$limit) + 1); echo "<br />"; if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>&nbsp "; } $pages=intval($numrows/$limit); if ($numrows%$limit) { $pages++; } if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?>
  3. friendly bump... I have tried several things to no avail :'(
  4. I need that if the database field is empty it displays a message. Here is what I have tried but I know that the fields have information and is displaying N/A. My if statement must be wrong or if any one knows a better way to do it would be great. Thanks in advance! <?php // Connect database. $host=""; // Host name. $db_user=""; // MySQL username. $db_password=""; // MySQL password. $database=""; // Database name. mysql_connect($host,$db_user,$db_password); mysql_select_db($database); $result=mysql_query("SELECT * FROM financial WHERE financial.Scholarship_group='Art' AND financial.Type='Scholarship'"); ?> <?php while($row=mysql_fetch_assoc($result)){ ?> <strong>Name: <?php echo $row['Name']; ?></strong><br> <strong>Selection Criterion:</strong> <?php if (mysql_num_rows($row) == 0) { echo "N/A"; } else { echo $row['Selection_Criterion']; } ?> <br> <strong>Award Information:</strong> <?php if (mysql_num_rows($row) == 0) { echo "N/A"; } else { echo $row['Award_Information']; } ?> <?php } // End while loop. ?>
  5. why is this only showing the name in id 1 instead of all of the ones in the name field? <?php require_once('Connections/cuaa_scholarships.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_cuaa_scholarships, $cuaa_scholarships); $query_Recordset1 = "SELECT financial.Name FROM financial"; $Recordset1 = mysql_query($query_Recordset1, $cuaa_scholarships) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mysql_free_result($Recordset1); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><?php echo $row_Recordset1['Name']; ?></td> </tr> </table>
  6. is there a javascript code I could use to get this to happen?
  7. I think is this where it needs to be done with an if or else then echo? if ( $params->get( 'menu_images' ) ) { $menu_params = new stdClass(); $menu_params =& new mosParameters( $mitem->params ); $menu_image = $menu_params->def( 'menu_image', -1 ); if ( ( $menu_image <> '-1' ) && $menu_image ) { $image = '<img src="'. $mosConfig_live_site .'/images/stories/'. $menu_image .'" border="0" alt="'. $mitem->name .'"/>'; if ( $params->get( 'menu_images_align' ) ) { $txt = $txt .' '. $image; } else { $txt = $image .' '. $txt; } } } return $txt; }
  8. Here is the code I have it where is is taking image 1 which is an arrow but on click when the parent clicked and child is open I need the parent image to show an arrow down... <?php /** * @version $Id: mod_mainmenu.php,v 1.2 2005/08/02 08:21:53 akede Exp $ * @package Mambo * @copyright (C) 2000 - 2005 Miro International Pty Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * Mambo is Free Software */ /** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); if (!defined( '_MOS_MAINMENU_MODULE' )) { /** ensure that functions are declared only once */ define( '_MOS_MAINMENU_MODULE', 1 ); /** * Utility function for writing a menu link */ function mosGetMenuLink( $mitem, $level=0, &$params ) { global $Itemid, $mosConfig_live_site, $mainframe; $txt = ''; switch ($mitem->type) { case 'separator': case 'component_item_link': break; case 'content_item_link': $temp = split("&task=view&id=", $mitem->link); $mitem->link .= '&Itemid='. $mainframe->getItemid($temp[1]); break; case 'url': if ( eregi( 'index.php\?', $mitem->link ) ) { if ( !eregi( 'Itemid=', $mitem->link ) ) { $mitem->link .= '&Itemid='. $mitem->id; } } break; case 'content_typed': default: $mitem->link .= '&Itemid='. $mitem->id; break; } // Active Menu highlighting $current_itemid = $Itemid; if ( !$current_itemid ) { $id = ''; } else if ( $current_itemid == $mitem->id ) { $id = 'id="active_menu'. $params->get( 'class_sfx' ) .'"'; } else { $id = ''; } $mitem->link = ampReplace( $mitem->link ); if ( strcasecmp( substr( $mitem->link,0,4 ), 'http' ) ) { $mitem->link = sefRelToAbs( $mitem->link ); } $menuclass = 'mainlevel'. $params->get( 'class_sfx' ); if ($level > 0) { $menuclass = 'sublevel'. $params->get( 'class_sfx'); } switch ($mitem->browserNav) { // cases are slightly different case 1: // open in a new window $txt = '<a href="'. $mitem->link .'" target="_blank" class="'. $menuclass .'" '. $id .'>'. $mitem->name .'</a>'; break; case 2: // open in a popup window $txt = "<a href=\"#\" onclick=\"javascript: window.open('". $mitem->link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\" ". $id .">". $mitem->name ."</a>\n"; break; case 3: // don't link it $txt = '<span class="'. $menuclass .'" '. $id .'>'. $mitem->name .'</span>'; break; default: // formerly case 2 // open in parent window $txt = '<a href="'. $mitem->link .'" class="'. $menuclass .'" '. $id .'>'. $mitem->name .'</a>'; break; } if ( $params->get( 'menu_images' ) ) { $menu_params = new stdClass(); $menu_params =& new mosParameters( $mitem->params ); $menu_image = $menu_params->def( 'menu_image', -1 ); if ( ( $menu_image <> '-1' ) && $menu_image ) { $image = '<img src="'. $mosConfig_live_site .'/images/stories/'. $menu_image .'" border="0" alt="'. $mitem->name .'"/>'; if ( $params->get( 'menu_images_align' ) ) { $txt = $txt .' '. $image; } else { $txt = $image .' '. $txt; } } } return $txt; } /** * Vertically Indented Menu */ function mosShowVIMenu( &$params ) { global $database, $my, $cur_template, $Itemid; global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_shownoauth; /* If a user has signed in, get their user type */ $intUserType = 0; if($my->gid){ switch ($my->usertype) { case 'Super Administrator': $intUserType = 0; break; case 'Administrator': $intUserType = 1; break; case 'Editor': $intUserType = 2; break; case 'Registered': $intUserType = 3; break; case 'Author': $intUserType = 4; break; case 'Publisher': $intUserType = 5; break; case 'Manager': $intUserType = 6; break; } } else { /* user isn't logged in so make their usertype 0 */ $intUserType = 0; } if ($mosConfig_shownoauth) { $sql = "SELECT m.* FROM #__menu AS m" . "\nWHERE menutype='". $params->get( 'menutype' ) ."' AND published='1'" . "\nORDER BY parent,ordering"; } else { $sql = "SELECT m.* FROM #__menu AS m" . "\nWHERE menutype='". $params->get( 'menutype' ) ."' AND published='1' AND access <= '$my->gid'" . "\nORDER BY parent,ordering"; } $database->setQuery( $sql ); $rows = $database->loadObjectList( 'id' ); // indent icons switch ( $params->get( 'indent_image' ) ) { case '1': // Default images $imgpath = $mosConfig_live_site .'/images/M_images'; for ( $i = 1; $i < 7; $i++ ) { $img[$i] = '<img src="'. $imgpath .'/indent'. $i .'.png" alt="" />'; } break; case '2': // Use Params $imgpath = $mosConfig_live_site .'/images/M_images'; for ( $i = 1; $i < 7; $i++ ) { if ( $params->get( 'indent_image'. $i ) == '-1' ) { $img[$i] = NULL; } else { $img[$i] = '<img src="'. $imgpath .'/'. $params->get( 'indent_image'. $i ) .'" alt="" />'; } } break; case '3': // None for ( $i = 1; $i < 7; $i++ ) { $img[$i] = NULL; } break; default: // Template $imgpath = $mosConfig_live_site .'/templates/'. $cur_template .'/images'; for ( $i = 1; $i < 7; $i++ ) { $img[$i] = '<img src="'. $imgpath .'/indent'. $i .'.png" alt="" />'; } break; } $indents = array( // block prefix / item prefix / item suffix / block suffix array( '<table width="100%" border="0" cellpadding="0" cellspacing="0">', '<tr align="left"><td>' , '</td></tr>', '</table>' ), array( '', '<div style="padding-left: 4px">'. $img[1] , '</div>', '' ), array( '', '<div style="padding-left: 8px">'. $img[2] , '</div>', '' ), array( '', '<div style="padding-left: 12px">'. $img[3] , '</div>', '' ), array( '', '<div style="padding-left: 16px">'. $img[4] , '</div>', '' ), array( '', '<div style="padding-left: 20px">'. $img[5] , '</div>', '' ), array( '', '<div style="padding-left: 24px">'. $img[6] , '</div>', '' ), ); // establish the hierarchy of the menu $children = array(); // first pass - collect children foreach ($rows as $v ) { $pt = $v->parent; $list = @$children[$pt] ? $children[$pt] : array(); array_push( $list, $v ); $children[$pt] = $list; } // second pass - collect 'open' menus $open = array( $Itemid ); $count = 20; // maximum levels - to prevent runaway loop $id = $Itemid; while (--$count) { if (isset($rows[$id]) && $rows[$id]->parent > 0) { $id = $rows[$id]->parent; $open[] = $id; } else { break; } } mosRecurseVIMenu( 0, 0, $children, $open, $indents, $params ); } /** * Utility function to recursively work through a vertically indented * hierarchial menu */ function mosRecurseVIMenu( $id, $level, &$children, &$open, &$indents, &$params ) { global $Itemid; if (@$children[$id]) { $n = min( $level, count( $indents )-1 ); echo "\n".$indents[$n][0]; foreach ($children[$id] as $row) { echo "\n".$indents[$n][1]; echo mosGetMenuLink( $row, $level, $params ); // show menu with menu expanded - submenus visible if ( !$params->get( 'expand_menu' ) ) { if ( in_array( $row->id, $open )) { mosRecurseVIMenu( $row->id, $level+1, $children, $open, $indents, $params ); } } else { mosRecurseVIMenu( $row->id, $level+1, $children, $open, $indents, $params ); } echo $indents[$n][2]; } echo "\n".$indents[$n][3]; } } ?>
  9. tried this to no avail? $headers .= "BCC: info@fortwaynerestaurant.net\r\n";
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.