Page 1 of 1

Entering an array into a function

Posted: Tue Mar 08, 2005 6:02 pm
by azz0r_
Say I have a while loop of rows from the database and do

function post($thread) //thread being the row from the database.

How in the function would I then break up the $thread because atm it wont.

Posted: Tue Mar 08, 2005 6:09 pm
by feyd
it'd be exactly like if you were accessing it inside the loop (excluding variables that are not known to it, or set before the function call)

Posted: Tue Mar 08, 2005 6:10 pm
by azz0r_
how do you mean?

If I do $thread->post inside the function it returns nothing, even If I make $thread a global.

Posted: Tue Mar 08, 2005 6:33 pm
by feyd
post your code for the function and the while loop calling it.

Posted: Wed Mar 09, 2005 2:06 am
by azz0r_
Here, Ive cut alot of code out cos its huge

feyd | hey look ma,

Code: Select all

is on.[/color]

Posted: Wed Mar 09, 2005 2:19 am
by feyd
I'd suggest using mysql_fetch_assoc(). I'd also suggest passing it by reference. You can lose the global for it.