Jump to content

samshel

Members
  • Posts

    837
  • Joined

  • Last visited

Posts posted by samshel

  1. Not sure if this is what u r looking for:

     

    0) Back up table so if anything goes wrong, u r not in soup :)

    1) Delete the 10800 row.

    2) use the following ALTER command to reset the auto increment:

     

    ALTER TABLE  `table_name` AUTO_INCREMENT=773

  2. try this:

    <?php 
    $arr = array(
          "Monday 11:50 AM",
                    "Saturday 11:50 PM",
          "Saturday 11:58 PM",
          "Sunday 12:03 AM",
          "Sunday 12:15 AM"
    );
    function changeTime(&$val, $key){
       $val = strtotime($val) + 53; //add 53 seconds
    }
    
    //Convert the array into Linux time in seconds
    array_walk($arr, 'changeTime');
    //sort array
    sort($arr);
    //Convert the current time into Linux time in seconds, include seconds in current time
    $currentTime = strtotime(date("l h:i:s A"));
    
    $intCount = 0;
    //loop through the array till you find a value greater than current time.
    while($arr[$intCount] < $currentTime) {
       $intCount++;
    }
    echo  date("l h:i A", $arr[$intCount]);
    ?>
    
    

     

    2 Changes:

     

    1) add 53 seconds inside the changeTime function.

    2) Use seconds as well when converting current time into Linux seconds.

     

    Thanks

    Sam

  3. try this:

    <?php 
    $arr = array(
    	"Monday 11:50 AM",
                    "Saturday 11:50 PM",
    	"Saturday 11:58 PM",
    	"Sunday 12:03 AM",
    	"Sunday 12:15 AM"
    );
    function changeTime(&$val, $key){
    $val = strtotime($val);
    }
    
    //Convert the array into Linux time in seconds
    array_walk($arr, 'changeTime');
    //sort array
    sort($arr);
    //Convert the current time into Linux time in seconds
    $currentTime = strtotime(date("l h:i A"));
    
    $intCount = 0;
    //loop through the array till you find a value greater than current time.
    while($arr[$intCount] < $currentTime) {
    $intCount++;
    }
    echo  date("l h:i A", $arr[$intCount]);
    ?>
    

  4. <?php 
    $str = "Sameer";
    //convert string in array
    $arr = str_split($str);
    $arrMod = array();
    for($intCount=0;$intCount<count($arr);$intCount++){
    //Find Ascii Value
    $intAscii = ord($arr[$intCount]);
    //If a or A, make it z or Z
    if($intAscii == 97) $strMod = "z";
    else if($intAscii == 65) $strMod = "Z";
    //else find charachter with ascii value 1 less than current
    else $strMod = chr($intAscii-1);
    $arrMod[$intCount] = $strMod; 
    }
    $strMod = implode($arrMod);
    echo $strMod;
    ?>
    

     

    just another way

  5. Where is $id defined ?

     

    - Also echo the query and directly fire it on DB console to see if you see any errors

    - Use mysql_error() to debug

    <?php
    include("db.inc.php");  //connects to database
    $result2 = mysql_query("SELECT messid,message,from,read,date FROM messages WHERE id = '$id'") or die (mysql_error());  // line 36
         while ($row2 = mysql_fetch_row($result2)) {  // line 37
         $message = $row2[1];  // line 38
         echo "$message";  // line 39
         }  // line 40
    ?>
    

  6. Try this:

     

    //Bring this statement out of while
    $_SESSION['MONEYOWED'] = "0.00";
    while($ckdue =mysql_fetch_array($ckifdue)){
           //remove if else, even if amount due is 0, it will add 0
           $_SESSION['MONEYOWED'] = $_SESSION['MONEYOWED'] + $ckdue['AmountDue'];
    
    

     

    Keep the remaining code as it is.

  7. $commonFields = array ('bed','bath','school');
    $fieldNames = array ('Lisitng File #', 'Chain Y/N', 'Bedrooms', 'Half Baths', 'School District');
    $arrMatches = array();
    foreach ($fieldNames as $field) {
       foreach ($commonFields as $commonfield) {
           if(eregi($commonfield, $field))
           $arrMatches[] = $field;
       }
    }
    print_r($arrMatches);
    

     

    not tested.

     

    Also i assume u must have thought about this and were looking for a shorter way, but still trying ;)

  8. Opening up your database and allowing firing of any queries is as good as giving complete access of the database. They can fire the delete, drop and other harmful queries.

     

    What i suggest u need is a webservice. Which will host all the functions that they want to do. For example, if they want to update thier own details, you can expose a function called updateUser which will check the username, password and update the database.

     

    This way the queries stay with u and ur database is safe.

     

    Apologies if i misunderstood ur requirements

     

    Sam

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