Jump to content

kevin7

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Posts posted by kevin7

  1. Hi all, I have been messing up with timezone lately. I solved most of the problems in PHP side, but I have a small issue with mySQL.

     

    I store created date in timestamp format using this php function:

     

    $date = explode('-', '11-01-2010');
    $start_date = gmmktime(0, 0, 0, $date[1], $date[0], $date[2]);
    
    //then i store it into a column called start_time, varchar 255
    

     

    and then, I retrieve it using this mySQL command:

     

    select * from event where active=1 and date_format(from_unixtime(start_time), "%d-%m-%Y")='11-01-2010';
    

     

    but apparently, mySQL convert the date to 12-01-2010, not 11-01-2010.. it's the timezone problem. Normally, I would use for-loop, loop through the array and convert the timestamp stored in database using gmdate() function with php. But in this case, I have to do it with mySQL command. Does mySQL have gmdate() equivalent function?

     

    Many Thanks!

  2. I'm suck at foreach with multidimension array,

     

    I have this array structure:

     

    $item = array(
                'chicken' => array('description' => 'a chick', 'quantity' => '5kg'),
                'tomatoes' => array('description' => 'a tomato', 'quantity' => '0.5kg')
                );
    

     

    and I will the output looks like this, it list out the item name only in a ul list

     

    - chicken

    - tomatoes

     

    this is the code i was using, it display "array"

     

    foreach  ($item as $value => $key) {
       echo '<li><a href="#">' . $item[$value] . '</a></li>';								
    }								}
    

     

    hmm, what went wrong?

     

    Thanks heaps

  3. I want to list all my files in a directory that has this pattern:

     

    profile-create, profile-post, navigation-list, or access-list-create

     

    all of them will have a hyphen in between two words

     

    this is the one im developing, but it isnt working.

     

    $files = scandir($basePath);
    foreach($files as $key => $value){
    
    if (preg_match("/^[a-z]*[\-][a-z]*$/", $value)) echo $value . '<br/>';
    
    }
    

     

    can anyone provide me a correct expression?

     

    thanks.

  4. Hi,

     

    I have done some research on looking for a solution to detect bounced email.

    first of all, safe_mode for php must be OFF in order to use returnPath in mail() function.

    And this would be the first obstacle since most of the web servers have it ON.

     

    Anyway, my concept of detecting a bounce email is, set returnPath, and then write a php script to receive mail from the returnPath, and search for email title that matches "Undelivered Mail Returned to Sender", after that, process the content of the email, and should able to find the invalid email address and reason of undelivered.

     

    my concept... in my own opinion, feasible but impractical, is that anyway to detect bounced email?

     

    correct me if i am wrong. thanks!

  5. Hi!

     

    I have a question, I saw from a tutorial, but i couldnt understand this,

    what's the difference with the following:

     

    mysql_query(some_query_string)

    @mysql_query(some_query_string)

     

    what does the alias mean?

     

    and, i saw some of the functions in a class have something like this

     

    function getPageNav($queryvars = '')

     

    why do they assign $queryvars to nothing? in what situation we need to do this?

     

    thanks!

  6. hi saint959...

    yes it did, you need to get inside the cart...

    if two same products were added, it will show only 1...

    but if two different products were added, it will show 2...

     

    haha, but yea, it can be configured to ur way...

  7. Hi GuiltyGear... yea, i know...

    I dont have IE 7 installed... my computer is too lousy...

    I know I can do a lot of things to enhance it...

     

    this is just my own experiment, if I really published it online for business purpose,

    I will make sure it looks good in all the browsers not only IE...

     

    so don't worry, and :) thx dude..

  8. good critiques, I will work on it for my future project!

    I'm mastering CSS tableless coding now.

     

    Regarding to that Power Button... hehe, not good in graphic design hey?

    If you observe it deeply, it's actually a G rotated 90 degree anti-clockwise! :P

    So, I suppose to make a G in that sphere, and then.. yea why not make it look like a powerbutton instead.. haha... sorry if it made you puke...

     

    thank for all the critiques and compliments!

  9. I have just finished this, for my own research...

    It's a PHP Object-Oriented Shopping Cart + AJAX (partially)

    I used LyteBox (Good Stuff!), MySQL, PHP and CSS Tableless Coding!

     

    You can click on pictures, and the cart will update itself.

    It has a great potential to expand into bigger and complicated system.

     

    I did this with Mozilla, it doesnt look good in IE and I don't even bother to fix it.

    So, check it with Mozilla.

     

    http://www.roxes.net/oocart/

     

    Please comment. Thanks

  10. kristen: it depends on you, 3 of them will work, but the third once can save you some times.

    for my own preference, i use the second one.

     

    bubblebla: call data from table? i assume you mean from database's table..

    not sure if my explanation is correct,

     

    normally, when u make a query, you will have something like..

    $row = mysql_fetch_array($query);

     

    if you don't know the column name, you can echo the data like $row[0], $row[1]....

    if you know the column name, you can echo the data like $row['id'], $row['name']...

    if you use extract($row), you can straight away use it according to the column name, $id, $name...

     

    cheers...

  11. i hv restarted the apache server, now the include_path is correct, but it still displays the same error message? is it due to the new version of pear, it changed the DB.php's name?

  12. erm, php?

    you can add extra column in each of the record (username, password) or extra columns (login date, modified date)

    or for best database practise, make it another table, so it will be something like

    login(id,username,password,login_date,modified_date) id is the foreign key to your existing directory table.

     

     

     

     

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