Re: Problems with rand and arrays

From: Date: Thu, 07 Dec 2000 17:41:34 +0000
Subject: Re: Problems with rand and arrays
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-29167@lists.php.net to get a copy of this message
Broder B wrote: > > Yeah I think it would work if it were't for this error: > > Parse error: parse error, expecting `']'' in C:\Program\Apache > Group\Apache\htdocs/boa/home.php on line 24 > > I just can't figure this one out. > > $arrRandIdx = array_rand($arrRes, 3); > > $rand_text_result = query("SELECT * FROM poems WHERE id=$arrRes[$arrRandIdx[0]]") > ok, then this way: $rand_text_result = query( "SELECT * FROM poems WHERE id=".$arrRes[$arrRandIdx[0]] ); -- Pavel a.k.a. Papi

« previous php.general (#29167) next »