The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Add UserSpice to CRUD or vice versa - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: General (https://userspice.com/forums/forumdisplay.php?fid=20)
+--- Forum: New to UserSpice? (https://userspice.com/forums/forumdisplay.php?fid=22)
+--- Thread: Add UserSpice to CRUD or vice versa (/showthread.php?tid=884)



Add UserSpice to CRUD or vice versa - PaulM - 12-12-2017

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();
}
?>