2
What I am doing is the sum of the number of tables according to the id of the user who is logged in, the way I am doing no value is demonstrated.
Bench:
id id_affiliate user_ip date
1 2 162.70.25.00 2015-11-06 08:49:47
2 1 162.70.25.00 2015-11-06 09:49:47
3 2 162.70.25.00 2015-11-06 10:49:47
4 2 162.70.25.00 2015-11-06 11:49:47
2 1 162.70.25.00 2015-11-06 00:49:47
Code:
<?
$connect = mysql_connect('localhost', 'root', 'pass');
if (!$connect) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $connect);
$consulta = mysql_query("SELECT id_affiliate FROM easy_affiliate_stats WHERE id_affiliate = . "$_SESSION["id_affiliate"], $connect);
//Conta quantos registros possuem na tabela
$total= mysql_num_rows($consulta);
//Mostra o valor
echo "Atualmente há $total registros";
?>
id_affiliate is returning right? within SESSION
– Sr. André Baill
The page is coming blank, shows no error within localhost.
– the flash
I posted an answer for you.
– Sr. André Baill
When submitting the request, the page returns blank, no error and no information on the page. :/
– the flash
Error is in query concatenation
– Sr. André Baill
Ok. I am using the code you sent me, the page is opening normally, but returns me the value of 0 records.
– the flash
If you are returning zero, you are not passing $_SESSION correctly, echo $_SESSION["id_affiliate"] to see what returns.
– Sr. André Baill
I did the informed and returned no value.
– the flash
Then the problem is in your Sesssion that is not working. Are you starting Session at the beginning of the file? session_start();
– Sr. André Baill
It was not, I added and still continues to return 0, it will be because the entries are saved in another table?
– the flash
Managed to make?
– Sr. André Baill