mardi 4 juillet 2017

How will this PHP mysqli would be in PDO connection?

Im trying to change my code to PDO but how much does it affect the code?

This is the code for getting some testing posts with ID title and description. Any ideas?, suggestions?

<?php
    require '../db_config.php';
    $id  = $_GET["id"];

    $post = file_get_contents('php://input');
    $post = json_decode($post);
    $sql = "UPDATE items SET title = '".$post->title."', description = '".$post->description."' WHERE id = '".$id."'";
    $result = $mysqli->query($sql);


    $sql = "SELECT * FROM items WHERE id = '".$id."'"; 


    $result = $mysqli->query($sql);
    $data = $result->fetch_assoc();

    echo json_encode($data);

?>




Aucun commentaire:

Enregistrer un commentaire