ORDER BY
Is there a special trick to insert a statement when adding ORDER by in the sql srtring? I can get the statement to correctly query the db, but when I add ORDER BY, i get an error. I have ORDER BY with column labels from both tables with the same error.
$sql = "SELECT * FROM websiteloads.loads, websiteloads.loadattachments WHERE receiver = ? ORDER BY ?";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql))
{
mysqli_stmt_close($stmt);
mysqli_close($conn);
exit();
}
$role = $sessionCompanyID;
$status = trim($_POST['status']);
$sortBy = "dock";
mysqli_stmt_bind_param($stmt, "is", $role, $sortBt);
mysqli_stmt_execute($stmt);
Subject
Written By
Posted
ORDER BY
April 14, 2021 09:26AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.