Donc ton if se lance bien mais ta requête fonctionne mal du fait de ce NULL.
Quelle est ton url ?
http://site.fr/?id=x&action=read
?
Code : Tout sélectionner
<?php
$id = $_GET['id'];
$action = $_GET['action'];
if ($action == 'read' ) {
$sql = "SELECT * FROM `tables` WHERE id = ".$id;
} elseif ($action == 'write') {
etc...
}
?>