Jump to content

samshel

Members
  • Posts

    837
  • Joined

  • Last visited

Posts posted by samshel

  1. i think it has nothing to do with filename..

     

    it checks the relative path when it tries to include the file.

     

    example:

     

    index.php

    members/members.php

    includes/config.inc.php

     

    in index.php

     

    you can..

     

    include("members/members.php");

    include("includes/config.inc.php");

     

    as from the DIR where index.php is, it can access the two folders and files inside them..

     

    to include config.inc.php from members.php

     

    include("../includes/config.inc.php");

     

    as members.php is inside members folder, it will have to look up the includes folder one level up (and hence ../) from where it is located.

     

     

  2. or you can try...

     

    <?php
                        $timestamp = mktime( 0, 0, 0, $cMonth, 1, $cYear );
                        $maxday    = date( "t", $timestamp );
                        $thismonth = getdate( $timestamp );
                        $startday  = $thismonth['wday'];
    
                        for( $i=0; $i < ( $maxday+$startday ); $i++ ) {
    
                            if( ( $i % 7 ) == 0 ) { echo "<tr>\n"; }
                            if( $i < $startday ) { echo "<td></td>\n";}
                           else {
                                if(date("N", strtotime($cYear."-".$thismonth."-".($i - $startday + 1))) == 7) {
                                    echo ($cYear."-".$thismonth."-".($i - $startday + 1)). " is Sunday !! Hurray !!";
                                } else {
                                    echo ($cYear."-".$thismonth."-".($i - $startday + 1)). " is a WeekDay  and my boss just called !!";
                                }
                                echo "<td align='center' valign='middle' height='20px;'>". ( $i - $startday + 1 ) . "</td>\n";
    
                            }
    
                            if( ( $i % 7 ) == 6 ) { echo "</tr>\n"; }
                        }
    ?>
    
    

  3. try sending a simple mail..if it works , problem is with code, else it is with mail setup

     

    mail("youremail@domain.com", "test", "test", 'From: TEST <youremail@domain.com>');
    

     

    and yes check ur spam mail folder too :)

  4. u can check if it is sent..the mail() function returns it, but it does not tell u whether it reached the destination properly or not.

     

    u have to configure something like smtp to actually send mail. PHP mail() function uses it, it itself is not a mail engine.

  5. its with regard to the situation..if the number of things are increasing and after some time you have say 100 items to check, then it is easier to define an array instead of writing 100 conditions with OR

     

    ofcourse this is my thought.

  6. if there is a single DB interface for all queries, then u can easily print queries which are fired. else i m not sure if there is any software which does DB monitoring like this , atleast i m not aware.

     

    i will keep monitoring this post to see if anybody comes up with a name :) i will be interested.

  7. should be able to do this

    $var = 1;
    if($var == 1 OR 2 OR 3 OR 4){
    // do it
    }
    

    not tested though

     

    i think this will not work...

    try this..

    $var = 1;
    if($var == 1 OR $var == 2 OR $var == 3 OR $var == 4){
    // do it
    }
    

     

    OR better

     

    <?php 
    $var = 1;
    $arr = array(1,2,3,4);
    if(in_array($var,$arr)){
    echo "Sucess";
    }
    ?>
    

  8. where ur populating all ur variables try doing this..

     

    $info_id = ((trim($info['id']) != "") ? $info['id'] : " ");
    

     

    this code checks if the variable fetched from DB row has a value else assigns space to that variable. you can replace space with any char u like..

     

    do it for all variables

  9. 3) Optimize Cron queries, sometimes denormalizing database helps to gain performance. you may wish to distribute the operations between cron and end of game. Like instead of doing complete operation of rating, just do some calculations and store in fields in DB, Cron will refer to these fields and complete the operation.

    4) If the system is already database/code optimized (indexes, less queries, de normalized) then you can go for MySQL replication.

  10. Ahh. When I started writing that code I was in the minset of the conflict could either be overlapping the beginning or ending of a current registration. As I wrapped my head around the clauses and started revising them I didn't realize I came up with the same thing which handles every eventuality.

     

    So, all that is needed is this

    $query = "SELECT * FROM reservations
              WHERE $new_start_date <= 'end_date' AND $new_end_date >= 'start_date'";
    

     

    also add the

     

    or die(mysql_error()); <<< on the end of the mysql_query

     

    You are correct, but I'm not going to always add ALL the details not specific to the solution. For example, youwould also want to use mysql_real_escape_string() on the POST values as well. I leave it up to the OP to implement all the other necessities.

     

    please correct me if i am wrong, but this will cover only if the new period is completely within the old period and not the overlap(if start a new period is within old, but end is out of it, this should also be not allowed)

     

    i think this will work..

     

    $query = "SELECT * FROM reservations
              WHERE (
                      ($new_start_date >= 'start_date' AND $new_start_date <= 'end_date') OR 
                      ($new_end_date >= 'start_date' AND $new_end_date <= 'end_date')
    ";
    

  11. <?php 
    $month_list = array();
    
    for( $i=1;$i<13;$i++) {
    $month_list[$i] = date("F", mktime(0, 0, 0, $i, 1, 2008));
    }
    print_r($month_list);
    $newmonthlist = $month_list;
    foreach($newmonthlist as $monthnumber=>$month) {
       if( $monthnumber < date("n")) {
    	unset($newmonthlist[$monthnumber]);
    	$newmonthlist[$monthnumber] = $month." ".(date("Y")+1);
       } else {
            $newmonthlist[$monthnumber] = $month." ".date("Y");
       }
    }
    echo "<br>";
    print_r( $newmonthlist);
    ?>
    

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