Welcome to WebmasterWorld Guest from 18.104.22.168
$advquery = "SELECT SUM(pc_count) as amount FROM $tablename WHERE pc_place IN('" . implode("','", $_POST['chosenoption']) . "')";
$adv = mysql_fetch_array($advcresult);
echo" $adv[amount] ";
Would anyone know why?
It doesn't use reserved words either.
Heres the table structure, just in case this is the prob.
CREATE TABLE placecount (
pc_count varchar(20) NOT NULL default '',
pc_place varchar(60) NOT NULL default '',
PRIMARY KEY (pc_place),
KEY pc_place (pc_place)
Thanks for any pointers.
echo"$advchrow[amount] here ";
:( Oh well, tried your suggestion but no joy.
I get "No result".
This is so weird, coz like I said, when I cut and past the echoed $advquery from the submitted page directly via phpmyadmin, the very same query works.
I think I might need to rethink my plan.
One thing that could be making a difference between venues is, where does $_POST['chosenoption'] come from? Have you tried a,
to see if the array is really there.
Also, I was moving hastily when I gave you the mysql_error() line. You need to echo it or put it in die(), etc.
if(!$advcresult) echo mysql_error(); //or
I wish you well.
another thought. If you haven't included method="post" in your form tag, the array may be in $_GET.
...and just echo out $advcresult to see that in isn't a typo when setting $tablename, or something.
Let me know what you find out.
Yes I'd checked to see if the array existed, and checked the form action of the sending page was set to POST.
> if(!$advcresult) die(mysql_error());
This unlocked it. No connectin to Database (hangs head in shame) How did I miss this? Sigh...
I'd failed to include the require "../dbconn.php"; line in an if condition of the script.
Feel like a right plonker now!
Thanks very much for all your help, :) its very much appreciated.