Another Simple array question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rdionne1187
Forum Newbie
Posts: 17
Joined: Tue Feb 01, 2005 9:30 am
Location: CT

Another Simple array question

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$partnumber doesn't work now?

print_r($partnumber);
rdionne1187
Forum Newbie
Posts: 17
Joined: Tue Feb 01, 2005 9:30 am
Location: CT

Post by rdionne1187 »

all of a sudden it works? im so confused!
rdionne1187
Forum Newbie
Posts: 17
Joined: Tue Feb 01, 2005 9:30 am
Location: CT

Post by rdionne1187 »

so confused i thought that it worked of course... can someone tell me how to assign variable arrays from mysql?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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);
rdionne1187
Forum Newbie
Posts: 17
Joined: Tue Feb 01, 2005 9:30 am
Location: CT

Post 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
Post Reply