Jump to content

Help for a rockie!!.. Php and Oracle


angelicaescobar

Recommended Posts

??? Hi friends!, I am working in a php and oracle project, and i am new, a rockie.  The project is a scheduler, for an office. Simple: the epmloyees habe to say in with schedule wants to work ((four blocks of working-hours), and it goes to register in a database.

 

I am in the part of booking, and i have problems here:

 

i dont know how to make, if one date is already taked, and tell to the user.

 

I will like to give in the IU the posibility to choose the block (work schedule)  of the day with radio buttons.

 

I want to check before in the database wich block is occupied, and make to appear 'no-available' the radio buttons.

 

As you can see in my code i am new... please , be patient with me...  :-\  Thanks!!! 

 

here is my code...

 

 

<?php

 

    define("FileName", "submit.php");

    include_once("errorhandler.inc.php");

        include_once(RelativePath . "/headerweek.php");

?>

<HTML>

<HEAD>

      <link rel="stylesheet" type="text/css" href="data/css/default.css" />

</HEAD>

<BODY>

<?php

    $bnum = $_POST["bnum"];                //receive the block-schedule value

    $username = $_SERVER["REMOTE_USER"];  //Obtain the user_id

    extract($_GET);

 

 

    //Connect to DB

    $conn=ocilogon('mydatas','****','datas');

    $id_sentencia = ociparse($conn);

    ociexecute($id_sentencia, OCI_DEFAULT);

ocifreestatement($id_sentencia);

    //Connected

?>

 

    <table class="Header" cellspacing="0" cellpadding="0" border="0">

      <tr>  <br>

              <td class="HeaderLeft"><img src="Styles/Office/Images/Spacer.gif" border="0"></td>

              <th> <center><?php echo("  Confirmation for:  ".$username)  ?>      <?php echo (" Work on: ".$dayID." / " .$monthID." / ".$yearID)?>     <?php echo ("Block Number: " .$bnum) ?> </center> </th>

              <td class="HeaderRight"><img src="Styles/Office/Images/Spacer.gif" border="0"></td>

      </tr>

      </table>

 

<?php

      //convert the picked date in a string, then can make the comparation and work with it.

          $datum="$yearID-$monthID-$dayID";

 

      //Check if the date and block  is already taked

            $checking = "SELECT count(*) from booking where (datebook like to_date('$datum','YYYY MM DD')) and (block_num like ($bnum))";

            $id_statement = ociparse($conn,$checking) or die ("parse error");

            ociexecute($id_statement, OCI_DEFAULT) or die ("execute error");

            ocifreestatement($id_statement);

            // here muss verify if the block is ocupied

 

      //Insert the selected-block in the schedule

          $insertar = "INSERT INTO booking (booking_id, user_id, block_num, datebook, cal_id) VALUES (booking_seq.NEXTVAL,'$username',$bnum,to_date('$datum','YYYY MM DD'),1)";

            $id_selection= ociparse($conn,$insertar) or die ("parse error");

            ociexecute($id_selection, OCI_DEFAULT) or die ("execute error");

            ocifreestatement($id_selection);

 

 

 

 

      // print the head of the grid-schedule day

        include_once("gridschedule.php");

 

 

 

      //  print the workers of the day (date picked).

          $consulta = "SELECT user_id, to_char(datebook, 'YYYY MM DD'), block_num from blockschedule.booking where datebook like to_date('$datum','YYYY MM DD')";

          $id_sentencia = ociparse($conn,$consulta);

            ociexecute($id_sentencia, OCI_DEFAULT);

          while (ocifetchinto($id_sentencia,$row=null, OCI_ASSOC)){

              print '<table border="1">';

              print'<tr>';

                foreach($row as $item) {

                print "<td>$item</td>";

                  }

                      print '</tr>';

              print '</table>';

            }

          ocifreestatement($id_sentencia);

 

 

 

?>

 

 

<?php

 

ocicommit($conn);

ocilogoff($conn);

 

set_error_handler("eh");

include_once(RelativePath . "/footer.php");

 

?>

 

 

</BODY>

</HTML>

Link to comment
https://forums.phpfreaks.com/topic/136041-help-for-a-rockie-php-and-oracle/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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