My site is giving me this message:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT CONCAT(Title, ', ',Content) AS Story FROM News Feed ORDER BY Date ASC' at line 2
Query: SELECT CONCAT(Author, ', ',Date) AS Author, SELECT CONCAT(Title, ', ',Content) AS Story FROM News Feed ORDER BY Date ASC
and the PHP looks like this
<?php
require_once 'Connections/AberDigs.php';
$AberDigs = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($AberDigs->connect_error) {
die('Could not connect to MySQL: ' . $AberDigs->connect_error);
}
$q = "SELECT CONCAT(Author, ', ',Date) AS Author,
SELECT CONCAT(Title, ', ',Content) AS Story FROM News Feed ORDER BY Date ASC";
$r = @mysqli_query ($AberDigs, $q); //Run query
if ($r) { //if ran OK disp records
//Table
echo '<table align="center"
cellspacing="3" cellpadding="3"
width="75%">
<tr><td align="left"><b>Written By</b></td><td align="left"><b>Story</b></td></tr>
';
//Fetch and print records
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
echo '<tr><td align="left">' .
$row['Author'] . '</td><td align="left">'
. $row['Story'] . '</td></tr>
';
}
echo '</table>'; // Close the table
mysqli_free_result ($r); //free up resources
} else { //if it didn't run OK
//Pub mes:
echo '<p class="error"> news could not be retrieved, sorry.</p>';
//debug mes:
echo '<p>' . mysqli_error($AberDigs) . '<br/><br />Query: ' . $q . '</p>';
}
mysqli_close($AberDigs)
?>
I've gotten in touch with my host but they've not replied to me yet
Basically I've been learning to do this stuff using one method from a book and so I'm a bit naive as to how to go about putting an alternative syntax in to make it work.
Could anyone please help me by giving me some help, preferrably idiot proof 😕
Thanks in advance.