wonderphp

Some wonder in PHP


MySql

  • Add recurring task php

    <?php $startDate = $postData[‘start_date’]; $endDate = $postData[‘end_date’]; $endDate = date(“Y-m-d”, strtotime($endDate . ” +1 day”)); /* For weekly schedule * frequency_id: *      ‘1’ => ‘Daily’, *      ‘2’ => ‘alternative day’, *      —-Every——– *      ‘3’ => ‘Monday’, *      ‘4’ => ‘Tuesday’, *      ‘5’ => ‘Wednesday’, *      ‘6’ => ‘Thursday’, *      ‘7’ => ‘Friday’, *      ‘8’ =>… Continue reading

  • Get current weeks record from mysql

    Your date field must of datetime type and sql query will be like : select * from table_name where yearweek(DATE(field_name), 1) = yearweek(curdate(), 1) Continue reading

  • Maintain display order field in php

    Remember I am considering following two parameters table name – DisplayOrder column name to reorder = O_nbr if you need to shift the O_nbr (order number) from 10 to 1 you just need to call the method as select UpdateOrder(10,1); // it will return you the proper message either updated or not.. or whatever the… Continue reading

  • Serial Number in Mysql

    SET @rownum := 0; select @rownum :=@rownum + 1 AS rank,EmpID,EmpName,EmpCity from employeedetails where 1=1; Continue reading

About Me

A seasoned web developer with over 14 years of experience, has honed a craft across a variety of frameworks and platforms.

Newsletter