And yet another thing i have overseen in my statement ..
If you remove the first for loop, also change the sql query. But I'm
sure you saw that already
NEW QUERY:
$sql = "SELECT study,symbol FROM test WHERE study IN ('".implode(', ',
$myArray)."')";
--
PHP General Mailing List (http://www.php.ne
I actually would do more like:
$myArray[$study][$symbol] = true;
No need to call in_array.
Probably won't matter, really, but it's a good practice for when you end up
doing the same kind of code for an array with thousands of elements.
--
PHP General Mailing List (http://www.php.net/
Thanks Yeti, it works.
Best, Andrej
Yeti wrote:
Correcting myself now ..
$myArray = array('b2005', 'b2008');
$sql = "SELECT study,symbol FROM test WHERE study IN ('$myArray[$i]')";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) {
while ($myrow = mysql_fetch_array($result)) {
Correcting myself now ..
$myArray = array('b2005', 'b2008');
$sql = "SELECT study,symbol FROM test WHERE study IN ('$myArray[$i]')";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) {
while ($myrow = mysql_fetch_array($result)) {
if (in_array($myrow['study'], $myArray))
$combi
> How should I proceed? Thanks in advance for any suggestions.
Since you are looping through the result already, why not do it this way ..
$combinedArray = array();
for ($i=0;$i 0) {
while ($myrow = mysql_fetch_array($result)) {
if (in_array($myrow['study'], $myArray))
$combinedArray[$m
Dear all,
I have a MySQL table 'test' which includes two columns: 'study' and
'symbol':
study symbol
a2008 A
a2008 B
a2008 C
a2008 D
b2005 A
b2005 B
b2005 E
Using POST variable I passed 'study' values into $myArray:
// $myArray is variable length; used only two values in example
$myArray =
6 matches
Mail list logo