Results 1 to 2 of 2
Jan 3, 2012, 17:08 #1
- Join Date
- Aug 2010
- 2 Post(s)
- 0 Thread(s)
Do I need more error-handling on Results-Set?
Below is a snippet that involves retrieving an Article...
// Execute query.
// Store results.
// Check # of Records Returned.
// Article was Found.
$articleExists = TRUE;
// Bind result-set to variables.
mysqli_stmt_bind_result($stmt, $articleID, $title, $description, $keywords,
$heading, $subHeading, $publishedOn, $author,
$body, $referenceListing, $endnoteListing);
// Fetch record.
// Close prepared statement.
mysqli_stmt_close($stmt); // ????
In other words, if something fails, can I assume that the *entire process* of "Bind result-set to variables" would fail?
The context of my question is really whether I need to INITIALIZE variables like "$articleID" or "$body" for fear that if the query didn't return these required fields that I would get an undefined variable error?!
I did initialize these variables since they are optional...
$subHeading = $referenceListing = $endnoteListing = '';
Jan 3, 2012, 17:33 #2