Variable Overload?

Today I worked on the RUD in my database CRUD (Create, Read, Update, Delete). I was trying to get the RU to work. For the sake of efficiency, I put my desire to display sender and receiver on hold and just made a table pulling straight from the documents database. That worked and I added in links to the “full data” and “edit” pages, only one of which sort of exists at the moment. Most of today was spent working on edit.

Taking some excellent advice, I broke things out into pieces. First step: pulling the record ID as stored in the URL (written into the url in the showdocs page) into the code on the editdocs page. Note that the snippets below assume you’ve connected to the database somewhere upcode.

if (isset($_GET[‘kp_doc_id’])) {
echo "Isset Success. <br />";}
else{ echo "Problems";}

Then get the id and echo it to make sure the value is set correctly.

if (isset($_GET[‘kp_doc_id’])) {
echo "Isset Success. <br />";
// make sure the ‘id’ value is valid
if (is_numeric($_GET[‘kp_doc_id’]) && $_GET[‘kp_doc_id’] > 0) {
// get ‘id’ from URL
$id = $_GET[‘kp_doc_id’];
echo $id;}

Once I got all of that to work, I followed Sasha’s lead and added in a $stmt. However, I seem to be running into problems binding more than a few variables and plugging them into the form. Everything works fine if I only bind one or two, but with all the ones I need it seems to grind to a halt.

I’ve made the pages live anyway. Showdocs will give you access to edit docs (by clicking on edit). The code is on git gist, since it was longer than I cared to put here. Critiques welcome.