Jump to content

vinoindiamca

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Posts posted by vinoindiamca

  1. Hi i need to calculate minutes to hours calculation

    i got output like 11:79

    then i coded like

     

    if($timmin>60)

    {

    $newtimmin=intval(floor($timmin/60));

    $newtimhr=intval(floor($timhr+$newtimmin));

    }

    else

    {

    $newtimmin=$timmin;

    $newtimhr=$timhr;

    }

    $time_add = $newtimhr.":".$newtimmin;

     

    After this coding i got output as 12:1 here 12 hours is correct but minutes to be 19 right

    12:19 to be return please help me

     

  2. Thank you sir,

                      Just give me the details to add total number of hours worked. I have stored from time and to time as varchar because i need to show it like 10:30.

    S.No Date            Project      Status        From Time    To Time      Hours worked

    1 10-03-2009    Proj1      Completed      09:15 AM 11:15 AM  02:00

    2 10-03-2009    Proj2    Pending      09:25 AM 12:40 PM 03:15

    3 10-03-2009    Proj3    Pending      09:52 AM 11:38 AM 01:46

    4 10-03-2009    Proj4  Completed      09:52 AM 12:38 PM 02:46

     

    Total Hours                                                                              8 Hours

     

    I am getting like this result here i am getting only hours added but minutes are not added.

    Please help in this

     

    My PHP Code is as below

    $queryses = "SELECT *  FROM empproject where uid='$uid'";

    $resultses=mysql_query($queryses) or die(mysql_error());

     

    $query2 = "SELECT COUNT(*) AS numrows FROM empproject where uid='$uid'";

    $result2 = mysql_query($query2) or die('Error, query failed');

    $row2 = mysql_fetch_array($result2);

    $numrows = $row2['numrows'];

     

    for ($j = 0; $j<=$numrows; $j++)

      {

    while($resses=mysql_fetch_array($resultses))

    {

    $tot2=$resses['totalhrs'];

    $tot1="00:00";

                            $sumss+=AddPlayTime($tot1,$tot2);// This code adds start time and end time

    }

    }

     

     

     

     

  3. Hi have problem of adding total number of hours and minutes in a recordset

    My record is like

    From time    to time          total time

    9:30 AM      11:30 AM      2:00

    9:15 AM      10:15 AM      1:00

     

    ----------------------------------

                                        3:00 (Not worked)

    ----------------------------------

    I have code for adding two given time like start time and end time, but i need total number of hours worked. Please help in this.

     

    Following is the code for two given time

     

    $sum=AddPlayTime($tims,$tims1);// Adding two given hours and minutes like 1:30 and 2:30 gives 4:00

     

     

     

    function AddPlayTime ($oldPlayTime, $PlayTimeToAdd) {

        $pieces = split(':', $oldPlayTime);

        $hours=$pieces[0];

        $hours=str_replace("00","12",$hours);

        $minutes=$pieces[1];

        $oldPlayTime=$hours.":".$minutes;

        $pieces = split(':', $PlayTimeToAdd);

        $hours=$pieces[0];

        $hours=str_replace("00","12",$hours);

        $minutes=$pieces[1];

        $str = $str.$minutes." minute ";

        $str = "01/01/2010 ".$oldPlayTime." am + ".$hours." hour ".$minutes." minute ";

        if (($timestamp = strtotime($str)) === false) {

            return false;

        } else {

            $sum=date('h:i', $timestamp);

            $pieces = split(':', $sum);

            $hours=$pieces[0];

            $hours=str_replace("12","00",$hours);

            $minutes=$pieces[1];

            $sum=$hours.":".$minutes;

            return $sum;

        }

    }

     

     

  4. Hi,

        i need to split links and description from the following output

     

    <a href="http://www.12334.com" target="_blank"><b><font face="verdana" color="blue" size="2">Titile here </b></font></a><font face="verdana" color="black" size="2"><br>435345 contents herecontents here contents herecontents herecontents herecontents herecontents here.</font></a>

     

    Please help in this

  5. Nested While loop not working in IE but works perfect in Firefox

     

    i used tree view to list out my main category ,sub category and sub-sub category

    like

    Art (Main Category)

      |-Drawing(Sub Category)

      |-Painting

                |-Brush(Sub-Sub Category)

                |-Colors

     

    <?php

    include_once("../includes/connect.php");

    $select = "select * from maincat ";

    $res = mysql_query($select);

    $rec_count = mysql_num_rows($res);

     

     

     

    ?>

     

     

     

    <div id="sidetree">

    <div class="treeheader"> </div>

    <div id="sidetreecontrol"><a href="?#">Collapse All</a> | <a href="?#">Expand All</a></div>

    <?php

    while($row=mysql_fetch_assoc($res))

      {

    $mid=$row["mainid"];   

    $mname=$row['catname'];

    ?>

    <ul id="tree"><li>

    <strong>

    <a href="admin_mcatedit.php?cid=<?php echo $mid;?>"><?php echo $mname;  ?></a>

    </strong>

     

    <ul>

    <?php

    $select1 = "select * from subcat where mainid='$mid' ";

    $res1 = mysql_query($select1);

     

    while($row1=mysql_fetch_assoc($res1))

    {

    $sid=$row1["subid"];

    $subname=$row1['subcatname'];

    ?>

    <li><a href="admin_mcatedit.php?cid=<?php echo $sid;?>"><?php echo $subname;  ?></a>

    <ul>

    <?php

    $select2 = "select * from subsubcat where mainid='$mid' and subid='$sid' ";

    $res2 = mysql_query($select2);

     

    while($row2=mysql_fetch_assoc($res2))

    {

    $ssid=$row12["subsubid"];

    $ssubname=$row2['subsubcatname'];

    ?>

    <li><a href="admin_mcatedit.php?cid=<?php echo $ssid;?>"><?php echo $ssubname;  ?></a></li>

    <?php

    }

    ?>

    </ul>

    </li>

    <?php

    }

    ?>

     

     

    </ul>

    </li> <?php

    }

    ?>

    </ul>

     

    </div>

     

    Please help me

     

  6. Hi,

      I had a doubt in reseeding deleted values

    For example if records stored like

    S.No  Name    Contact

    1      aaa    5656656

    2      bbb    5656656

    3      ccc    5656656

    4      ddd    5656656

     

    if i used to delete one record of second record it looks

     

    S.No  Name    Contact

    1      aaa    5656656

    3      ccc    5656656

    4      ddd    5656656

     

    i need the result to be reseed values like

     

    1      aaa    5656656

    2      ccc    5656656

    3      ddd    5656656

     

    Please help in this

     

     

     

  7. Hi i got error in my mysql stored procedures

     

    CREATE PROCEDURE getbooknew(IN names varchar(100),IN sets int(10),IN rows int(10))

    begin

    select * from booking where Name Like names ORDER BY bdate DESC LIMIT sets,rows;

    end

     

    sets and rows is for limit the records . I need to fetch records by using this query please help in this.

     

  8. Hi

      i am workin with phpmyadmin3.1.1rc, when i create stored procedures like

     

    DELIMITER $$

    CREATE PROCEDURE `myproc`()

    BEGIN

    SELECT 'it works!';

    END$$

     

    Procedure successfully created but  when i call the procedure it doesn't works please help in this

     

    CALL myproc(); it gives error like

    #1312 - PROCEDURE test3.myproc can't return a result set in the given context

     

     

     

     

     

  9. Hi please help in this

    I written stored procedure through phpmyadmin it give error

    create procedure sp_validation2(in u varchar(100), out a varchar(500))

    begin

    select address into a from booking where name=u;

    END

     

    Error:

     

    Error

     

    SQL query: Documentation

     

    CREATE PROCEDURE sp_validation2( IN u varchar( 100 ) , out a varchar( 500 ) ) BEGIN SELECT address

    INTO a

    FROM booking

    WHERE name = u;

     

    MySQL said: Documentation

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

     

     

    Please help me

  10. Hi,

        I have doubt regarding Stored procedure. I used to write stored procedures in SQLServer. At present i am working with MYSQL. I need to use stored procedures in my project. Now i am using with direct query like "select * from table" this mades very slow system to use. I need help that, How to write stored procedures in mysql and how to fetch mysql stored procedure in to PHP.

     

    Please give me some example code to understand easily...

     

    Thanks in advance...

     

    Regards,

    Vinod

  11. Hi,

      I have session problem in my code

     

    <?php

      session_start();

      if($_SESSION["username"]!="") {

          header("location: welcome.php");

      }

    ?>

     

     

    Here session_start() gives an error like

    Warning: session_start() [function.session-start]: open(C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\php\session\sess_uvu8ver7m73v61ejvbit5jho87, O_RDWR) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Ajax\ajax_datagrid\login.php on line 2

     

    Please give me the solution to change any codes in PHP.ini file

     

     

  12. Hi ,

        I Need help

    if given date is between $firstDate1 and $firstDate2 then

    do

    $payment=$offroomamt * $days;

    else

    if given date is not in $firstDate1 and $firstDate2 then

    echo"Invalid date";

     

    For this i need code for "not greater than" and "not lessthan" symbol to proceed validation i used following code but it gives error please give the solution to check not greater than also

     

     

     

    if($typroom=='1' && $sestime=='1')

    {

      if( $arrivaldt >= $firstDate1 && $arrivaldt <= $firstDate2  )

      {

          $payment=$offroomamt * $days;

       

      }

      if( $arrivaldt >= $secondDate1 && $arrivaldt <= $secondDate2 )

      {

          $payment=$sesroomamt * $days; 

         

      }

    //i need help in below code

      if( $arrivaldt !>= $firstDate1 && $arrivaldt !<= $firstDate2  )

      {

            echo"Invalid date";

      }

      if( $arrivaldt !>= $secondDate1 && $arrivaldt !<= $secondDate2 )

      {

        echo"Invalid date";

      }

     

     

     

     

    }

  13. Hi Please give me the code

     

    i need date between two days

     

    if given date(25-jan-2008) is between 15-jan-2008 and 15-Mar-2008    then price =2000

    if given date(25-Mar-2008) is between 16-Mar-2008 to 15-Jun-2008  then  price =4000

     

    Please give me code in php to check

     

     

     

     

     

  14. If User insert date like 12-dec-2008

     

    insert into test values(1,'12-Dec-2008');

    it gives error

    ERROR 1292 (22007): Incorrect datetime value: '12-Dec-2008' for column 'todate'

    at row 1

    please help in this

     

    I know mysql date format like 2008-12-12 . but i need '12-Dec-2008' convert to  2008-12-12 this

     

     

  15. Hi

     

    I need help yaar regarding date format in mysql

    $name=$_POST["txtname"];

    $comp=$_POST["txtcomp"];

    $addr=$_POST["txtaddr"];

    $ardt=$_POST["txtardt"];$drdt=$_POST["txtdrdt"];

    $typroom=$_POST["typroom"];

    $bookby=$_POST["txtbookby"];

    $phone=$_POST["txtphone"];

    $email=$_POST["txtemail"];

    $mobile=$_POST["txtmobile"];

    $paysel=$_POST["txtpaysel"];

     

    $query="insert into booking values(NULL,'$name','$comp','$addr',$ardt,$drdt,$typroom,'$bookby','$phone','$email','$mobile',$paysel)";

     

    insert into booking  values(NULL,'erter','tert','34534',12/12/2008,12/12/2008,1,'345','43543534','5435','43534',1) 

     

    mysql> select * from booking;

    +--------+-------+-------------+-------------+-------------+---------------+----

    --------+----------+----------+---------+--------+---------+

    | bookid | Name  | CompanyName | FullAddress | ArrivalDate | DepartureDate | Typ

    eofroom | Bookedby | PhoneNo  | EmailId | Mobile | Payment |

    +--------+-------+-------------+-------------+-------------+---------------+----

    --------+----------+----------+---------+--------+---------+

    |      1 | dfsdf | sfsdfsdf    | sdfs        | 0000-00-00  | 0000-00-00    |

          1 | 4353534  | 345345  | 535    | 5345  |      1 |

    |      2 | fsdf  | sdfsdf      | sdfsd      | 0000-00-00  | 0000-00-00    |

          1 | sdf      | sdfds    | fsdfsd  | fsdfsd |      1 |

    |      3 | dsf  | dsfdsf      | sdfsdf      | 0000-00-00  | 0000-00-00    |

          2 | 23423    | 4234    | 24      | 32423  |      1 |

    |      4 | erter | tert        | 34534      | 0000-00-00  | 0000-00-00    |

          1 | 345      | 43543534 | 5435    | 43534  |      1 |

    |      5 | erter | tert        | 34534      | 0000-00-00  | 0000-00-00    |

          1 | 345      | 43543534 | 5435    | 43534  |      1 |

    +--------+-------+-------------+-------------+-------------+---------------+----

    --------+----------+----------+---------+--------+---------+

    5 rows in set (0.00 sec)

     

    User Entering the date format like 12/12/2008

     

    [/]

    [][/]
×
×
  • 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.