Re: Re: can a session be used in a query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 7, 2009 at 4:10 PM, Frank Stanovcak <blindspotpro@xxxxxxxxxxx>wrote:

>
> ""Terion Miller"" <webdev.terion@xxxxxxxxx> wrote in message
> news:37405f850901071354p7abd0aa8i7c96cf69c81fadb5@xxxxxxxxxxxxxxxxx
>
> >> >    $result=mysql_query($query) or die('Queryproblem: ' . mysql_error()
> >> > .
> >> > '<br />Executed            query: ' . $query);
> >> >             if (mysql_num_rows($result) >= '1'){
> >> >            while ($row = mysql_fetch_assoc($result)){
> >> >            echo $row['AddEditAdmin']; //to print out the value of
> >> > column
> >> > 'var1' for each record
> >> >      }
> >> >  }else{
> >> >                 echo 'No records found.';
> >> >   }
> >> > ?>
> >> >
> >> > anyone have ideas for me, the session user is working, and I need to
> >> > use
> >> > it
> >> > in the query to pull only that users data I also on the login page
> >> > where
> >> I
> >> > set that session all set it to = $UserName but when I try and use that
> >> > in
> >> > the query UserName = $UserName I get an undefined variable error...
> >> >
> >> > Really trying but not quite getting it...
> >> >
> >>
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >> Well I am def. further along, the query is working, I can echo fields in
> > the $row and get the results but when I try and use this:
> >
> >    <?php
> >    if ($row['AddEditAdmin'] == 'YES') {
> >    ?>
> > to sort out what menu items to load it just doesn't do its job.
> >
>
> I would say do this to see if what is in the return is what you are
> expecting
>
> foreach($row as $key=>$value){
> echo $key , ': ' , $value , '<br>';
> };
>
> just to make sure that the value is "yes", and not 1 or true or something
> like that.
>
> Frank
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> I will try that, thanks, I did just try to echo the $row['AddEditAdmin']
results, as I do in the query section and in that it does return YES or NO
like I expect, but when I tried to echo it down in the page where I need to
use it.... guess what..no echo... am I cutting my query off somewhere? could
it be the while statement ....

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux