$query = "SELECT name,rant,rating FROM rants ORDER by Id DESC ";
This is a query for one table, I need to pull information from two tables within the same database but I don't want to keep creating new queries eg. $query1, $query2, $query3...
Is it possible to write it all in one line eg. between the quotations or do I have to create separate queries per table?
UPDATE
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR.'dbconnect.php');
$link = new mysqli("$servername", "$username", "$password", "$dbname");
$query = "SELECT COUNT(*) FROM rants";
if ($result = $link->query($query)) {
/* fetch object array */
while ($row = $result->fetch_row()) {
if($row[0]==0){
echo "There are no entries.";
}else {
$query2 = "SELECT name,rant,rating FROM rants ORDER by Id DESC ";
if (($result = $link->query($query2))) {
/* fetch object array */
while ($row = $result->fetch_row()) {
}
}