
Originally Posted by
r937
unless you use (deprecated) ordinal position numbers in your ORDER BY clause, it will have no effect on sql
if you use arrays in handling your query results in php, with offset positions instead of column names in those arrays, you could mess up big time
What about in a Prepared Statement like this...
PHP Code:
// ****************
// Find Articles. *
// ****************
// Build query.
$q1 = 'SELECT section, heading, image, published_on, summary
FROM article
WHERE section=?';
// Prepare statement.
$stmt1 = mysqli_prepare($dbc, $q1);
// Bind variable to query.
mysqli_stmt_bind_param($stmt1, 's', $_GET['section']);
// Execute query.
mysqli_stmt_execute($stmt1);
// Store results.
mysqli_stmt_store_result($stmt1);
// Check # of Records Returned.
if (mysqli_stmt_num_rows($stmt1)>0){
// Articles Found.
// Bind result-set to variables.
mysqli_stmt_bind_result($stmt1, $section, $heading, $image, $publishedOn, $summary);
// Fetch below in loop...
Thanks,
Debbie
Bookmarks