Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by PravinS

  1. 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

  2. Try this function


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


  3. 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">


    if (isset($_POST['btnSubmit']))
    //you search code


  4. 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;



  5. Try this

    $res = mysql_query("SELECT id, DATE_FORMAT(date, '%S %D %Y') as dt, firstname, lastname, testimonial FROM testimonials ORDER BY date DESC LIMIT 10");
    while ($row = mysql_fetch_assoc($res)) {
    	echo "<b>{$row['firstname']} {$row['lastname']}</b><br />on {$row['dt']}<br />{$row['testimonial']}<br /><br />";


    If "date" is you field name then it should work.

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