if(category = 'bla') Maybe you shouldn't be using a constant if it's going to be changing each time the page loads. ---John Holmes... ----- Original Message ----- From: "Shachar Tal" <shacha6@zahav.net.il> To: <php-db@lists.php.net> Sent: Thursday, January 23, 2003 7:46 AM Subject: Re: While + Function > Thanks. your way to do it gave me a good idea, and it's working now :) > Now I have another small question: > > How can I check what's in a constant? > let's say i'm doing this : > define ( "category", $cat ); > > $cat can be something else each and every time the page loads, then, I want > to check what it is, like > if constant(category) = "bla" { > } > > whats the syntax for checking the value of it? > > thanks > > ----- Original Message ----- > From: "Jason Wong" <php-db@gremlins.biz> > Newsgroups: php.db > To: <php-db@lists.php.net> > Sent: Thursday, January 23, 2003 11:54 AM > Subject: Re: While + Function > > > > On Thursday 23 January 2003 06:04, Shahar Tal wrote: > > > Hello all! > > > > > > I got one page, with this code: > > > > > > <?php > > > echo insert_results(); > > > ?> > > > > > > Which grabs the data I send from another page, on that function. > > > Here is the important part of the function while code: > > > > > > while ($row = mysql_fetch_array($result)){ > > > function insert_results () { > > > extract($row); > > > echo "bla"; > > > } > > > } > > > > > > Ok, this is the problem. > > > As you can see, it takes the data from the dattabase, sticks it into the > > > function, and then the second page displays it. > > > don't get me wrong, this is working PERFECTLY and just the way I want > it, > > > and then comes my problem. > > > It works only with one row. it displays only one row, even when I know > > > there are more. no matter how many rows are in the database, > > > it will always output one "bla". > > > > > > I need to move on and display all the rows, just like 'while' should > work, > > > I don't know why it's not working. > > > Maybe I should stick it into a function array? but that's a bit strange > as > > > the 'while' command should do it automaticlly. > > > > Why have you defined your function insert_results() inside your > while-loop? > > > > You be doing something like this instead: > > > > function insert_results($row) { > > do_insert_row; > > } > > > > while ($row = mysql_fetch_array($result)) { > > insert_results($row); > > } > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.biz > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > > > /* > > Joe's sister puts spaghetti in her shoes! > > */ > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php