2016-ICT2613-portfolio_task5.php at master · deono_2016-ICT2613-portfolio · GitHub.pdf

Bindvalue practicenumber practicenumber statement

Info icon This preview shows page 1. Sign up to view the full content.

bindValue( ':practicenumber' , $practicenumber); $statement -> execute(); $result = $statement -> fetch(); return $result; } //update table with form data function update ($practicenumber, $name, $speciality, $fee) { global $db; $query = " UPDATE doctors " . "SET name = :name, speciality = :speciality, fee = :fee " . "WHERE practicenumber = :practicenumber" ; $statement = $db -> prepare($query); $statement -> bindValue( ':practicenumber' , $practicenumber); $statement -> bindValue( ':name' , $name); $statement -> bindValue( ':speciality' , $speciality); $statement -> bindValue( ':fee' , $fee); $statement -> execute(); $statement -> closeCursor(); } //delete data from table function delete ($practicenumber) { global $db; $query = " DELETE FROM doctors " . "WHERE practicenumber = :practicenumber" ; $statement = $db -> prepare($query); $statement -> bindValue( ':practicenumber' , $practicenumber); $statement -> execute(); $statement -> closeCursor(); } //insert data from form into table function insert ($practicenumber, $name, $speciality, $fee) { global $db; /* TODO add code to test if practicenumber already exists. * only a request to add a row with an existing * practicenumber should be allowed.*/ $query = " INSERT IGNORE INTO doctors " . "(practicenumber, name, speciality, fee) " . "VALUES " . "(:practicenumber, :name, :speciality, :fee)" ; $statement = $db -> prepare($query); $statement -> bindValue( ':practicenumber' , $practicenumber); $statement -> bindValue( ':name' , $name); $statement -> bindValue( ':speciality' , $speciality); $statement -> bindValue( ':fee' , $fee); $statement -> execute(); $statement -> closeCursor(); } /* ----- instructions ----- */ /* call function to get full result set to * populate the table with all the data */ $query_results = query_all(); //declare variables $option = filter_input ( INPUT_POST , 'option' ); $practicenumber = filter_input (
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '12
  • The Table, deono, 1 8.07 KB

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern