I'm attempring to save the keys of mysql records in an array but get the Fatal Error: Can't use function return value in write context.. The code is:

for ($i = 0; $i < $tranrows; ++$i)
{ $tranrec = mysql_fetch_row($tranresult);
  $keyarray($i) = $tranrec[0];
}

I've done all the mysql code OK; just trying to save the first field of the SELECTed record into an array for subsequent processing. If I remove the $tranrec[0] assignment everything works fine.

Use square bracket.

$keyarray[$i] = $tranrec[0];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.