Re: Re: can a session be used in a query?
| From: | Terion Miller | Date: | Wed, 07 Jan 2009 22:13:58 +0000 |
| Subject: | Re: Re: can a session be used in a query? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285616@lists.php.net to get a copy of this message | ||
On Wed, Jan 7, 2009 at 4:10 PM, Frank Stanovcak <blindspotpro@comcast.net>wrote:
>
> ""Terion Miller"" <webdev.terion@gmail.com> wrote in message
>
> news:37405f850901071354p7abd0aa8i7c96cf69c81fadb5@mail.gmail.com...
>
> >> > $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 ....