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
azz0r_
Forum Commoner
Posts: 27 Joined: Mon Jan 24, 2005 4:15 pm
Post
by azz0r_ » Tue Mar 08, 2005 6:02 pm
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.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Mar 08, 2005 6:09 pm
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)
azz0r_
Forum Commoner
Posts: 27 Joined: Mon Jan 24, 2005 4:15 pm
Post
by azz0r_ » Tue Mar 08, 2005 6:10 pm
how do you mean?
If I do $thread->post inside the function it returns nothing, even If I make $thread a global.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Mar 08, 2005 6:33 pm
post your code for the function and the while loop calling it.
azz0r_
Forum Commoner
Posts: 27 Joined: Mon Jan 24, 2005 4:15 pm
Post
by azz0r_ » Wed Mar 09, 2005 2:06 am
Here, Ive cut alot of code out cos its huge
feyd | hey look ma,
Last edited by
azz0r_ on Thu Mar 10, 2005 2:04 pm, edited 1 time in total.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Mar 09, 2005 2:19 am
I'd suggest using mysql_fetch_assoc(). I'd also suggest passing it by reference. You can lose the global for it.