ncomper
asked on
Display MY SQL advanced Count in PHP
Hi I have this PHP script below which works for a selcect count(*) from x
However when I put a more advanced MYSQL syntax in there it gives the following error"Notice: Undefined index: total in /var/www/dupe.php on line 12 Total ="
Any ideas
<?php
$con=mysqli_connect("local host","ccc ","N3wcccc 21","actcc ccaign");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = "select count(*) from activecampaign.em_exclusio n
Inner join activecampaign.em_subscrib er
ON em_exclusion.email = em_subscriber.email";
$result = mysqli_query($con, $query);
echo $result;
mysqli_close($con);
?>
However when I put a more advanced MYSQL syntax in there it gives the following error"Notice: Undefined index: total in /var/www/dupe.php on line 12 Total ="
Any ideas
<?php
$con=mysqli_connect("local
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = "select count(*) from activecampaign.em_exclusio
Inner join activecampaign.em_subscrib
ON em_exclusion.email = em_subscriber.email";
$result = mysqli_query($con, $query);
echo $result;
mysqli_close($con);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When in doubt, you can check the online man page for the return values from PHP functions. Example: Ask yourself, "What is the expected return value from this function?"
http://php.net/manual/en/mysqli.query.php
Some learning resources to help you get started with things like this are available in this article. Buy any of the books and give yourself a few weeks to read, study and practice. In no time you'll be able to do this yourself!
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html
http://php.net/manual/en/mysqli.query.php
Some learning resources to help you get started with things like this are available in this article. Buy any of the books and give yourself a few weeks to read, study and practice. In no time you'll be able to do this yourself!
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html
ASKER
Amazing thank you
Open in new window