The question in simple.
What i have and what's the problem?
I do have two dimensional array $someArray[][]. The first bracket i could put "subject" or "date". The second one, goes from 1 to 4 (just an example - $someArray['date'][0])
Now when i try to get some data from database with mysql_query() i have some problems. I am trying to use this two dimensional array in WHERE part in query.
Examples what works and what doesn't
$result = mysql_query("SELECT some from table where date='$someArray[date][0]' AND subject='$someArray[subject][0]') or die(mysql_error());
When i use this, it doesn't return me anything. But when i first assing those values to new variables:
$variable1 = $someArray['date'][0];
$variable2 = $someArray['subject'][0];
and then use them in query
`$result = mysql_query("SELECT some from table where date='$variable1' AND subject='$variable2') or die(mysql_error());
It works like a charm.
Question
Whats wrong with my first query, am I writing those arrays wrong? I get no errors.
Tried to put single apostrophes inside [] brackets in mysql query, but then i do get errors. Also it works without them if i use array like: $someotherArray[somedata] in query.
mysql_functions anymore. That is deprecated functionality in PHP and will be removed. Look at red block on php.net/manual/en/function.mysql-query.php. Change to mysqli or PDO for safety