Page 1 of 1

Another Simple array question

Posted: Mon Feb 21, 2005 5:58 pm
by rdionne1187
alrighty, I'm trying to assign parts of an array from mysql to a new array done like this,

Code: Select all

while($pn = mysql_fetch_array($result_numbers, MYSQL_NUM)){
    foreach($pn as $value){
      print($value.'<br>');
      $partnumber&#1111;]=$value;
    &#125;
  &#125;
and you've gessed it, it doesnt work, the line print($value....... works but i cant get the partnumber to work. I'm tired, please help.

Posted: Mon Feb 21, 2005 6:01 pm
by feyd
$partnumber doesn't work now?

print_r($partnumber);

Posted: Wed Feb 23, 2005 1:01 pm
by rdionne1187
all of a sudden it works? im so confused!

Posted: Wed Feb 23, 2005 7:15 pm
by rdionne1187
so confused i thought that it worked of course... can someone tell me how to assign variable arrays from mysql?

Posted: Wed Feb 23, 2005 7:32 pm
by feyd
I've posted this many times....:roll:

Code: Select all

$query = mysql_query($sql) or die(mysql_error());

while($results&#1111;] = mysql_fetch_row($query));
array_pop($results);

Posted: Wed Feb 23, 2005 10:56 pm
by rdionne1187
thank you, you cant imagine how long it took me to figure out it puts the rows into $results[0][0] instead of $results[0], I was getting so frustrated