Jump to content

Alith7

Members
  • Posts

    53
  • Joined

  • Last visited

Posts posted by Alith7

  1. I'm trying to blend together to menu scripts to have a nav bar effect along with a drop down.

     

    Here is the demo page

     

    what I would like to do is have the floating bar for the nav menu, move to the drop down menu when it's activated. Or, if not that then to either have the floating bar stay on the "services" button when hovering over the dropdown menu, or just go away completely would be ok too.

     

    Any ideas??

  2. you're right! RegEx is going to make my head hurt for a while.

     

    but, ok, I want to make sure I understand how this works and why, asking for the code is great but I haven't learned anything if I don't understand it, or worse, have it wrong.

     

    so we have the two chunks of code this one sets the data for the code to pick-up:

    $query_custData = sprintf("SELECT contact, cust_email FROM customer WHERE cust_id=%d LIMIT 0,1",$_GET['cust_id']);
       $result_custData = mysql_query($query_custData, $geQuote) or die(mysql_error());
       $row_custData = mysql_fetch_assoc($result_custData);
       echo $row_custData['contact'].":::".$row_custData['cust_email'];

     

     

    This one tells what to do with it:

    xmlHttp.onreadystatechange=function()
          {
             if(xmlHttp.readyState==4)
               {
                var re = /^([\s\S]*?)::[\s\S]*?)$/i;
                var match = re.exec(xmlHttp.responseText);
                if (match != null) {
                   document.getElementById('quote_to').value= match[1];
                   document.getElementById('email_to').value= match[2];
                }
               }
          }
             xmlHttp.open("GET", loaderphp+"?cust_id="+cust_id,true);
          xmlHttp.send(null);
       }

     

    So, if I'm understanding this right, the echo of the query results sets the variables in a form that the JS is looking for in the format of "text:::text" but hidden in the background.  the ::: being the key part. "[\s\S]*?" tells it that the data could be anything and could contain cases, but it is unknown.

     

    the "re" sets the search parameters so that when the function is run, it looks for the items separated by ::: and "/i" counts the results and puts them in an array.  the variable "match" sets off the execution of the search "re.exec".

     

    the IF statement then checks to make sure that the script returned something, if it did, find the elements and replace the value with the items from the match[] array.

     

    the xmlHttp.open reopens the page in the background with the cust_id values to pass to the GET script and reloads the backside without reloading the whole page.

     

    the xmlHttp.send(null) tells it not to send the form or process any other data in the reopening.

     

    Ok, that was a bit garbled, but I think it makes sense.  the only part I don't get is what the "xmlHttp.responseText" does/comes from.

  3. YAY!

    it works!! OMG I could kiss you!

     

    thank you so much for all your help!

    I NEVER would have figured it out otherwise!

     

    as I'm just starting to learn AJAX, can I ask what all the symbols in that line of code mean?  I can usually pick apart basic java to figure out what it's doing and why, but I have to say I'm a big confused by some of those.

  4. rawr!

     

    ok, so I found the flippin error

     

    the field in the table was cust_email not email.

     

    fixed that, passing this code in the address

        custtest.php?cust_id=105

    returned the correct data

        Julie:::JGomels@custwww.com

     

    but now I need the text fields to update.  here is what I have for test code atm:

     

    <?php require_once('Connections/geQuote.php'); ?>
    
    <?php
    
    mysql_select_db($database_geQuote, $geQuote);
    $query_listCustomer = "SELECT customer.cust_id, customer.name FROM customer ORDER BY customer.name";
    $listCustomer = mysql_query($query_listCustomer, $geQuote) or die(mysql_error());
    $row_listCustomer = mysql_fetch_assoc($listCustomer);
    $totalRows_listCustomer = mysql_num_rows($listCustomer);
    
    $selected=mysql_select_db($database_geQuote, $geQuote);
    if( isset($_GET['cust_id']) )
    {
       $query_custData = sprintf("SELECT contact, cust_email FROM customer WHERE cust_id=%d LIMIT 0,1",$_GET['cust_id']);
       $result_custData = mysql_query($query_custData, $geQuote) or die(mysql_error());
       $row_custData = mysql_fetch_assoc($result_custData);
       echo $row_custData['contact'].":::".$row_custData['cust_email'];
       exit; //we're finished so exit..
    }
    
    ?>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Untitled Document</title>
    
    <script language="javascript">
       function ajaxFunction(cust_id)
       {
          //link to the PHP file your getting the data from
          //var loaderphp = "quote.php";
          //i have link to this file
          var loaderphp = "<?php echo $_SERVER['PHP_SELF'] ?>";
         
          //we don't need to change anymore of this script
          var xmlHttp;
          try
           {
             // Firefox, Opera 8.0+, Safari
             xmlHttp=new XMLHttpRequest();
           }catch(e){
             // Internet Explorer
             try
             {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
             }catch(e){
                try
                {
                   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e){
                   alert("Your browser does not support AJAX!");
                   return false;
                }
             }
          }
         
          xmlHttp.onreadystatechange=function()
          {
             if(xmlHttp.readyState==4)
               {
                var re = /^(.*?)::.*?)$/i;
                var match = re.exec(xmlHttp.responseText);
                if (match != null) {
                   document.getElementById('quote_to').value= match[1];
                   document.getElementById('email_to').value= match[2];
                }           
               }
          }
    
       alert(loaderphp+"?cust_id="+cust_id);
       xmlHttp.open("GET", loaderphp+"?cust_id="+cust_id,true);
           xmlHttp.send(null);
       }
    </script>
    
    </head>
    
    <body>
    
    
    
    <select name="cust_id" id="cust_id" onchange="ajaxFunction(this.value);">
    
       
    <?php do { ?>
       <option value="<?php echo $row_listCustomer['cust_id']?>"><?php echo $row_listCustomer['name']?></option>
       <?php } while ($row_listCustomer = mysql_fetch_assoc($listCustomer));
      			$rows = mysql_num_rows($listCustomer);
      			if($rows > 0) {
         		 	mysql_data_seek($listCustomer, 0);
         			$row_listCustomer = mysql_fetch_assoc($listCustomer);
    	 			}
    ?>
    
            </select>
              <h2>Quoted to:</h2>
          <input name="quote_to" type="text" class="widebox" id="quote_to" maxlength="50" />
              <h2>Email to:</h2>
      <input name="email_to" type="text" class="widebox" id="email_to" />
    
    </body>
    </html>
    

  5. changed to this:

    if( isset($_GET['cust_id']) )
    {
       $query_custData = sprintf("SELECT contact, email FROM customer WHERE cust_id=%d LIMIT 0,1",$_GET['cust_id']);
       $result_custData = mysql_query($query_custData, $geQuote) or die(mysql_error());
       $row_custData = mysql_fetch_assoc($result_custData);
       echo $row_custData['contact'].":::".$row_custData['email'];
       exit; //we're finished so exit..
    }

     

    got this error

     

    Unknown column 'email' in 'field list'

  6. ok....so this works:

    $DATA = array( 
             1=> array("contact" =>"My Contact1", "email"=> "My Email1"),
             2=> array("contact" =>"My Contact2", "email"=> "My Email2")
       );
       $row_custData = $DATA[$_GET['cust_id']];

     

    this does not:

    $query_custData = sprintf("SELECT contact, email FROM customer WHERE cust_id=%d LIMIT 0,1",$_GET['cust_id']);
    $result_custData = mysql_query($query_custData);
    $row_custData = mysql_fetch_assoc($result_custData);

     

    The questions is...why?  it's rhetorical, I'm thinking out loud...erm, so to speak. unless you have an answer?

  7. I think I've narrowed down the problem to this section:

    $query_custData = sprintf("SELECT contact, email FROM customer WHERE cust_id=%d LIMIT 0,1",$_GET['cust_id']);
       $result_custData = mysql_query($query_custData);
       $row_custData = mysql_fetch_assoc($result_custData);

     

    somehow I think the cust_id isn't getting passed into the query, or something else is wrong with the query.

    Your test script worked fine.  when I replaced with the database variables, nothing happens.  I tried replacing the dynamically populated drop down with hard coded numbers, 1, 10, 15, 20, 25.  I confirmed that they all were cust_id #'s in the database, and that didn't work either.

     

    my mind is drawing a blank on what code to add to test the query results.

  8. ok...still not working.

     

    we have this part of the script:

    $selected=mysql_select_db($database_geQuote, $geQuote);
       if( isset($_GET['ajax']) )
    {
       $query_custData = sprintf("SELECT contact, email FROM customer WHERE cust_id=%d LIMIT 0,1",$_GET['ajax']);
       $result_custData = mysql_query($query_custData);
       $row_custData = mysql_fetch_assoc($result_custData);
       echo $row_custData['contact'].":::".$row_custData['email'];
       exit; //we're finished so exit..
    }

     

    The Function:

    <script language="javascript">
       function ajaxFunction(ID, Param)
       {
          //link to the PHP file your getting the data from
          //var loaderphp = "quote.php";
          //i have link to this file
          var loaderphp = "<?php echo $_SERVER['PHP_SELF'] ?>";
         
          //we don't need to change anymore of this script
          var xmlHttp;
          try
           {
             // Firefox, Opera 8.0+, Safari
             xmlHttp=new XMLHttpRequest();
           }catch(e){
             // Internet Explorer
             try
             {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
             }catch(e){
                try
                {
                   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e){
                   alert("Your browser does not support AJAX!");
                   return false;
                }
             }
          }
         
          xmlHttp.onreadystatechange=function()
          {
             if(xmlHttp.readyState==4)
               {
                var re = /^(.*?)::.*?)$/i;
                var match = re.exec(xmlHttp.responseText);
                if (match != null) {
                   document.getElementById('quote_to').value= match[1];
                   document.getElementById('email_to').value= match[2];
                }           
               }
          }
    
           xmlHttp.open("GET", loaderphp+"?ID="+ID+"&ajax="+Param,true);
           xmlHttp.send(null);
       }
    </script>

     

    and the form data:

    <select name="cust_id" id="cust_id" onchange="ajaxFunction('quote_to', this.value);">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_listCustomer['cust_id']?>"><?php echo $row_listCustomer['name']?></option>
              <?php
    } while ($row_listCustomer = mysql_fetch_assoc($listCustomer));
      $rows = mysql_num_rows($listCustomer);
      if($rows > 0) {
          mysql_data_seek($listCustomer, 0);
         $row_listCustomer = mysql_fetch_assoc($listCustomer);
      }
    ?>
            </select>
    </td>
          </tr>
           <tr>
            <td width="200" height="25"><div align="right">
              <h2>Quoted to:</h2>
            </div></td>
            <td>
    	<input name="quote_to" type="text" class="widebox" id="quote_to" maxlength="50" /></td>      </tr>
         <tr>
            <td width="200" height="25"><div align="right">
              <h2>Email to:</h2>
            </div></td>
            <td><input name="email_to" type="text" class="widebox" id="email_to" /></td>
          </tr>

     

    must be missing something that needs to be updated or isn't calling for the right data...but what?

  9. &(*%#Q&$

    this is annoying me.  I'm having a heck of time getting this code to crack for me!! so VERY frustrating!

     

    Ok, I see what mean by not working the way I want.

     

    What about by using the AJAX to update a variable that's being plugged into the text field value?

    so instead of this:

    $selected=mysql_select_db($database_geQuote, $geQuote);
       if( isset($_POST['Submit']) )
       {
          echo "<pre>";
          print_r($_POST);
       }
       if( isset($_GET['ajax']) )
       {
          //In this if statement
          switch($_GET['ID']) 
          {
             case "quote_to":
                $query_custData = sprintf("SELECT contact AS dbinfo FROM customer WHERE cust_id=%d",$_GET['ajax']);
             break;
             case "email_to":
                $query_custData = sprintf("SELECT email AS dbinfo FROM customer WHERE cust_id=%d",$_GET['ajax']);
             break;
          }
          
          $result_custData = mysql_query($query_custData);
          echo "";
          while ($row_custData = mysql_fetch_assoc($result_custData))
          {
             echo "{$row_custData['dbinfo']}";
          }
          exit; //we're finished so exit..
       }

     

     

    maybe like this??

    //call out variables as empty strings
    $updateContact = "";
    $updatedEmail = "";
    //then run script
    $selected=mysql_select_db($database_geQuote, $geQuote);
       if( isset($_POST['Submit']) )
       {
          echo "<pre>";
          print_r($_POST);
       }
       if( isset($_GET['ajax']) )
       {
          //In this if statement
          switch($_GET['ID']) 
          {
             case "quote_to":
                $query_custData = sprintf("SELECT contact, email FROM customer WHERE cust_id=%d",$_GET['ajax']);
             break;
          }
          
          $result_custData = mysql_query($query_custData);
          echo "";
          while ($row_custData = mysql_fetch_assoc($result_custData))
          {
             $updateEmail = $row_custData['email'];
             $updateContact = $row_custData['contact'];
          }
          exit; //we're finished so exit..
       }

     

    only it's not working!

  10. The data is simply a contact name (John Doe) and the email (JDoe@hotmail.com) associated with the customer account that was selected.  I have lazy salesmen.

    the DB structure is as follows:

     

    CREATE TABLE IF NOT EXISTS `customer` (

      `cust_id` int(10) unsigned NOT NULL auto_increment,

      `sales_id` int(10) unsigned default NULL,

      `name` varchar(40) NOT NULL default '',

      `street` varchar(50) default NULL,

      `city` varchar(50) default NULL,

      `state` char(2) default NULL,

      `zip` int(5) default '0',

      `phone` varchar(12) default NULL,

      `fax` varchar(12) default NULL,

      `contact` varchar(40) default NULL,

      `cust_email` varchar(50) default NULL,

      PRIMARY KEY  (`cust_id`)

    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=395 ;

     

    The coding pulls all the customer ID's and names from the table to fill the dropdown, what I want to do is have it pull the contact info and email to populate the appropriate text fields when the salesman picks a customer.  Does that make sense?

  11. ok, I made those changes, now when I try to select a customer, the whole customer list clears.

     

    sorry to post the whole code, I'm not sure what is causing the problem so I don't know what I can leave out.

     

    Thank you for your help!

     

    <?php require_once('Connections/geQuote.php'); ?>
    <?php
    if (!isset($_SESSION)) {
      session_start();
    }
    $MM_authorizedUsers = "quote";
    $MM_donotCheckaccess = "false";
    
    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
      // For security, start by assuming the visitor is NOT authorized. 
      $isValid = False; 
    
      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
      // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
      if (!empty($UserName)) { 
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
        // Parse the strings into arrays. 
        $arrUsers = Explode(",", $strUsers); 
        $arrGroups = Explode(",", $strGroups); 
        if (in_array($UserName, $arrUsers)) { 
          $isValid = true; 
        } 
        // Or, you may restrict access to only certain users based on their username. 
        if (in_array($UserGroup, $arrGroups)) { 
          $isValid = true; 
        } 
        if (($strUsers == "") && false) { 
          $isValid = true; 
        } 
      } 
      return $isValid; 
    }
    
    $MM_restrictGoTo = "noaccess.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
      $MM_qsChar = "?";
      $MM_referrer = "quote.php";
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
      $MM_referrer .= "?" . $QUERY_STRING;
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo); 
      exit;
    }
    ?>
    <?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;
    }
    }
    
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
    $editFormAction = "quote.php";
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "insertQuote")) {
      $insertSQL = sprintf("INSERT INTO quote (sales_id, cust_id, quote_to, email_to, title, quote, created) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['sales_id'], "int"),
                           GetSQLValueString($_POST['cust_id'], "int"),
                           GetSQLValueString($_POST['quote_to'], "text"),
                           GetSQLValueString($_POST['email_to'], "text"),
                           GetSQLValueString($_POST['title'], "text"),
                           GetSQLValueString($_POST['quote'], "text"),
                           $_POST['created']);
    
      mysql_select_db($database_geQuote, $geQuote);
      $Result1 = mysql_query($insertSQL, $geQuote) or die(mysql_error());
    
      $insertGoTo = "quote_listsort.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
    
    mysql_select_db($database_geQuote, $geQuote);
    $query_listSales = "SELECT salesrep.sales_id, CONCAT(salesrep.first_name,' ', salesrep.last_name) AS salesRep FROM salesrep ORDER BY salesrep.last_name, salesrep.first_name";
    $listSales = mysql_query($query_listSales, $geQuote) or die(mysql_error());
    $row_listSales = mysql_fetch_assoc($listSales);
    $totalRows_listSales = mysql_num_rows($listSales);
    
    mysql_select_db($database_geQuote, $geQuote);
    $query_listCustomer = "SELECT customer.cust_id, customer.name FROM customer ORDER BY customer.name";
    $listCustomer = mysql_query($query_listCustomer, $geQuote) or die(mysql_error());
    $row_listCustomer = mysql_fetch_assoc($listCustomer);
    $totalRows_listCustomer = mysql_num_rows($listCustomer);
    
    $selected=mysql_select_db($database_geQuote, $geQuote);
          if( isset($_POST['Submit']) )
          {
             echo "<pre>";
             print_r($_POST);
          }
          if( isset($_GET['ajax']) )
       {
          //In this if statement
          switch($_GET['cust_id'])
          {
             case "quote_to":
                $query_custData = sprintf("SELECT contact AS dbinfo FROM customer WHERE cust_id=%d",$_GET['ajax']);
             break;
             case "email_to":
                $query_custData = sprintf("SELECT email AS dbinfo FROM customer WHERE cust_id=%d",$_GET['ajax']);
             break;
          }
          
          $result_custData = mysql_query($query_custData);
          echo "";
          while ($row_custData = mysql_fetch_assoc($result_custData))
          {
             echo "{$row_custData['dbinfo']}";
          }
          exit; //we're finished so exit..
       }
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Graphic Edge Printing</title>
    
    <script language="javascript">
       function ajaxFunction(ID, Param)
       {
          //link to the PHP file your getting the data from
          //var loaderphp = "quote.php";
          //i have link to this file
          var loaderphp = "<?php echo $_SERVER['PHP_SELF'] ?>";
          
          //we don't need to change anymore of this script
          var xmlHttp;
          try
           {
             // Firefox, Opera 8.0+, Safari
             xmlHttp=new XMLHttpRequest();
           }catch(e){
             // Internet Explorer
             try
             {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
             }catch(e){
                try
                {
                   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e){
                   alert("Your browser does not support AJAX!");
                   return false;
                }
             }
          }
          
          xmlHttp.onreadystatechange=function()
          {
             if(xmlHttp.readyState==4)
               {
                //THIS SET THE DAT FROM THE PHP TO THE HTML
                document.getElementById('cust_id').innerHTML = xmlHttp.responseText;
               }
          }
           xmlHttp.open("GET", loaderphp+"?ID="+ID+"&ajax="+Param,true);
           xmlHttp.send(null);
       }
    </script>
    
    <?php include('style_rules.php'); ?>
    </head>
    
    <body>
    <div id="wrapper">
      <div id="titlebar"><img src="images/header.jpg" alt="Graphic Edge Printing" /></div>
      <div id="maincontent">
        <div id="nav">
          <?php include('navbar.php'); ?>
        </div>
        <h1>New Quote</h1>
        <form action="<?php echo $editFormAction; ?>" method="POST" name="insertQuote" id="insertQuote" target="_self">
          <p><table width="650">
          <tr>
            <td width="200" height="25"><div align="right">
              <h2>Sales Rep: </h2>
            </div></td>
            <td><select name="sales_id" id="sales_id">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_listSales['sales_id']?>"><?php echo $row_listSales['salesRep']?></option>
              <?php
    } while ($row_listSales = mysql_fetch_assoc($listSales));
      $rows = mysql_num_rows($listSales);
      if($rows > 0) {
          mysql_data_seek($listSales, 0);
      $row_listSales = mysql_fetch_assoc($listSales);
      }
    ?>
            </select>
    </td>
          </tr>
          <tr>
            <td width="200" height="25"><div align="right">
              <h2>Customer:</h2>
            </div></td>
            <td><select name="cust_id" id="cust_id" onchange="ajaxFunction('quote_to', this.value);">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_listCustomer['cust_id']?>"><?php echo $row_listCustomer['name']?></option>
              <?php
    } while ($row_listCustomer = mysql_fetch_assoc($listCustomer));
      $rows = mysql_num_rows($listCustomer);
      if($rows > 0) {
          mysql_data_seek($listCustomer, 0);
      $row_listCustomer = mysql_fetch_assoc($listCustomer);
      }
    ?>
            </select>
    </td>
          </tr>
           <tr>
            <td width="200" height="25"><div align="right">
              <h2>Quoted to:</h2>
            </div></td>
            <td><input name="quote_to" type="text" class="widebox" id="quote_to" maxlength="50" /></td>
          </tr>
      <tr>
            <td width="200" height="25"><div align="right">
              <h2>Email to:</h2>
            </div></td>
            <td><input name="email_to" type="text" class="widebox" id="email_to" /></td>
          </tr>
       <tr>
            <td width="200" height="25"><div align="right">
              <h2>Title:</h2>
            </div></td>
            <td><input name="title" type="text" class="widebox" id="title" maxlength="255" /></td>
          </tr>
          <tr>
            <td width="200" height="25" valign="top"><div align="right">
              <h2>Quote:</h2>
            </div></td>
            <td><textarea name="quote" id="quote" cols="54" rows="25"></textarea></td>
          </tr>
          <tr>
            <td width="200" height="25"><div align="right"></div></td>
            <td><input type="submit" name="Submit" value="Submit Quote" /></td>
          </tr>
        </table>
        <input name="created" type="hidden" id="created" value="NOW()" />
        <input type="hidden" name="MM_insert" value="insertQuote">
        </form>
      </div>
      <div id="footer"><?php include('copyright.php'); ?></div>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($listSales);
    
    mysql_free_result($listCustomer);
    ?>
    

  12. you need to call out your variable $Found before your query if you're going to use it in your query.

     

    your also calling out to echo the variable $ObjectID, but you don't assign that variable any value.

     

    and I would think maybe add a COUNT into the query and assign them into an array and return the 7th item of the array.

     

    Just a thought.

     

    I'd have to go look up how to use COUNT to make that work, but I would start with these corrections:

     

    <?php
      $Found = 7; 
      $Get = mysql_query("SELECT Odds,ObjectID FROM objectfinder WHERE Rareity='Museum' AND
             ObjectID < 2016 AND RecordID > $Found ORDER BY Odds ASC Limit 10") 
          Or die(mysql_error());
       $row = mysql_fetch_assoc($Get);
       $ObjectID = $row['ObjectID'];
           echo ($ObjectID);
        ?>

     

    Someone with more experience might have a cleaner way to do this, but it's an odd request to want to return a specific line in a query without knowing what the data you're looking for is, or what the resulting data you pull up would be.

×
×
  • 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.