Page 1 of 1

Array

Posted: Sat Oct 09, 2004 6:10 pm
by Shendemiar
I have a result like this:

Code: Select all

<?php
    while ($rivi = mysql_fetch_array($query, MYSQL_ASSOC))
    {
    $ID = ($rivi['teksti_id']);
    $S  = htmlentities($rivi['suomeksi']);
    $R  = htmlentities($rivi['ruotsiksi']);

    XXX
    }
?>
What suhould i put to XXX to get array with $ID as index, then both $S and $R for each index identified with, say S and R?

feyd | do not disable bbcode when you want to post code

Posted: Sat Oct 09, 2004 6:13 pm
by feyd

Code: Select all

$whatever[$ID] = array('S'=>$S, 'R'=>$R);
:roll:

Posted: Sat Oct 09, 2004 6:13 pm
by mudkicker
if i didn't misunderstand you this would help:

Code: Select all

<?php 
while ($rivi = mysql_fetch_assoc($query)) 
{ 
$ID[$rivi['teksti_id']]['S']= htmlentities($rivi['suomeksi']); 
$ID[$rivi['teksti_id']]['R'] = htmlentities($rivi['ruotsiksi']); 
} 
?>

Posted: Sat Oct 09, 2004 6:14 pm
by Shendemiar
Thanks, yes, i noticed the bbcode issue and fixed it while you were ansvering.

Posted: Sat Oct 09, 2004 6:15 pm
by mudkicker
oops! ;) feyd you are the fastest around here man :P

Posted: Sat Oct 09, 2004 6:16 pm
by jabbaonthedais
Does feyd even sleep?


feyd | very little :D

Posted: Sat Oct 09, 2004 6:23 pm
by nigma
Thank god someone else asked that! I was sitting hear typing my reply and I find out feyd already did reply. Although, in this case it was a good thing because it sounds like I misunderstood the question so I wouldn't have answered it accurately. Darn.

Posted: Sat Oct 09, 2004 6:24 pm
by mudkicker
:lol: this is another point of view ;)

Posted: Sat Oct 09, 2004 8:57 pm
by neophyte
jabbaonthedais wrote:Does feyd even sleep?


feyd | very little :D
Actually there have been a time or two when I was working really late at night and Feyd wasn't there immeadiately. Hail Feyd!

Posted: Sat Oct 09, 2004 8:58 pm
by Shendemiar
nigma wrote:Thank god someone else asked that! I was sitting hear typing my reply and I find out feyd already did reply. Although, in this case it was a good thing because it sounds like I misunderstood the question so I wouldn't have answered it accurately. Darn.
Yeah. It was FAST, and Simple, and Presice. Amazing forum this is. I've never been treated here with disrespect even thou sometimes i'm having hard time trying to make myself understood or then i just ask stupid things in the wrong place. I've allways gotten an answer that satisfied me. HAIL! Long live the... what's this places's name?

Posted: Sat Oct 09, 2004 10:50 pm
by nigma
lol. glad you like it, you should stick around.

Posted: Sun Oct 10, 2004 2:44 am
by mudkicker
I have the same thoughts with Shenemiar. It's very cool to be here :) Every question that i couldn't find an answer to -> comes here & get solved!!