12-12-2017, 11:45 AM
Hi, thanks for UserSpice, I can apply Php easily - I'm not yet good at Php.
How do I add UserSpice to a CRUD application?
I have a [MySql] table I have already linked several CRUD pages to; I'm thinking I haven't got them to work well with the UserSpice classes.
To start with, I have the following Php in the read.php CRUD page I need help with:
<?php
// require 'database.php';
$id = null;
if ( !empty($_GET['id'])) {
$id = $_REQUEST['id'];
}
if ( null==$id ) {
header("Location: index.php");
} else {
$pdo = Database::connect();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // I haven't appreciated much what this one does.
$sql = "SELECT * FROM bylaws where id = ?";
$q = $pdo->prepare($sql);
$q->execute(array($id));
$data = $q->fetch(PDO::FETCH_ASSOC);
DB::disconnect();
}
?>
How do I add UserSpice to a CRUD application?
I have a [MySql] table I have already linked several CRUD pages to; I'm thinking I haven't got them to work well with the UserSpice classes.
To start with, I have the following Php in the read.php CRUD page I need help with:
<?php
// require 'database.php';
$id = null;
if ( !empty($_GET['id'])) {
$id = $_REQUEST['id'];
}
if ( null==$id ) {
header("Location: index.php");
} else {
$pdo = Database::connect();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // I haven't appreciated much what this one does.
$sql = "SELECT * FROM bylaws where id = ?";
$q = $pdo->prepare($sql);
$q->execute(array($id));
$data = $q->fetch(PDO::FETCH_ASSOC);
DB::disconnect();
}
?>