This is something of a beginner's question, I've successfully set up a local database that returns the LOCATION column based on a search.
What I'd like to understand is which part of the code in the PHP file I can manipulate to return multiple / all columns from that search into a multi column div table, rather than just the LOCATION column. I've played around with using * instead of LOCATION but get an 'unexpected * on line 11' error when searching.
Any pointers would be of great use and help me to understand the fundamentals better.
JS File
$('input#name-submit').on('click', function() {
var name = $('input#name').val();
if ($.trim(name) != '') {
$.post('ajax/name.php', {name: name}, function(data) {
$('div#name-data').text(data);
});
}
});
PHP file (name.php)
<?php
if (isset($_POST['name']) === true & empty($_POST['name']) === false) {
require '../db/connect.php';
$query = mysql_query("
SELECT `LOCATION`
FROM `table 3`
WHERE `table 3`.`ARTIST` = '" . mysql_real_escape_string(trim($_POST['name'])) . "'
");
echo (mysql_num_rows($query) !== 0) ? mysql_result($query, 0, `LOCATION`) : 'Name not found';
}
mysqlideprecation protestors in 3,2,1...