Jump to content

shaddowman

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by shaddowman

  1. I think it will be like this

     

    From

    <input type="text" size="10" name="condition" class="do_input"

    value="<?php echo get_post_meta($pid, 'condition', true); ?>" />

     

    To

     

    Suppose the value will be "Other"

     

    <select>

    <option value="<?php echo get_post_meta($pid, 'condition', true); ?>" selected="selected"><?php echo get_post_meta($pid, 'condition', true); ?></option>

    <option value="New">New</option>

    <option value="Ued">Used</option>

    </select>

     

    You need to put logic in the "selected" attribute whether if it's selected or not by using tertoary operator.

  2. I think you need to use the built in PHP function "curent" for this array.

    <?php
    $theArray = array("first", "second", "third");
    print_r(current($theArray));
    ?>
    

     

    Please look at the reference php.net/manual/en/function.current.php

  3. $sql = $db->Query("
    SELECT `users`.`id` AS `userID`, `users`.`fullname` AS `fullName`.`mobile` AS `mobile`,`entries`.`time` AS `time` FROM `users` JOIN `entries` ON `users`.`id` = `entries`.`userID` WHERE `entries`.`time` BETWEEN CURDATE() AND CURDATE() - INTERVAL 8 DAY") or die(mysql_error());
    

     

    I think you need to use date aritmethic functions like DATEADD and DATEDIFF. Please follow this URL http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_datediff

     

    Example:

     

    Select date_add(curdate(), interval 31 day);

  4. I think the best possible solution is the use of built in PHP function parse_url.

    You can extract the domain name and might get the exact domain name by the help of string manipulator functions susch as substr() and strpos()

     

     

    <?php
    $url = parse_url("http://123.456.imageshack.us/image.png");
    print_r($url);
    ?>
    

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