Jump to content

PravinS

Members
  • Posts

    459
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by PravinS

  1. You can calculate total number of records in the table and then subtract 5 from it the your query will change as

     

     

     

    $displayrecords = $totalrecords - 5;
    $sql = "SELECT * from TABLENAME LIMIT 6, $displayrecords ";
    

     

  2. Also if you want to display any other text from table then you need to add field name in query and you drop down will be like this.

    while ($row=mysql_fetch_array($result))
    
            {
        
                echo '<option value="'.$row['supp_id'].'">'.$row['TXTFIELD'].'</option>\n';
            
            }
    

     

    check the TXTFIELD in drop down, just replace your field name there

  3. Try this function

     

    function sort_array($array, $key, $order)
    {
    if ($order=="DESC")
    	$or="arsort";
    else
    	$or="asort";
    for ($i = 0; $i < sizeof($array); $i++) 
    {
    	$sort_values[$i] = $array[$i][$key];
    } 
    $or($sort_values);
    reset ($sort_values);
    while (list ($arr_key, $arr_val) = each ($sort_values)) 
    {
    	$sorted_arr[] = $array[$arr_key];
    }
    return $sorted_arr;
    }
    
    

     

  4. Give name to submit button and write your search code in isset of submit button.

    <form method="get">
        <input type="text" name="search" value="<?php echo $search; ?>"> 
        <input type="submit" value="Search" name="btnSubmit">
    </form>
    

     

    <?php
    if (isset($_POST['btnSubmit']))
    {
    //you search code
    }
    ?>
    

     

  5. You can use this function

     

     

    function quote_smart($value)
    {
    // Stripslashes
    if (get_magic_quotes_gpc()) 
    {
    	$value = stripslashes($value);
    }
    // Quote if not a number or a numeric string
    if (!is_numeric($value)) 
    {
    	$value = "'" . mysql_real_escape_string($value) . "'";
    }
    return $value;
    }
    

     

     

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