Re: Ok another update
| From: | Todd Williamsen | Date: | Thu, 07 Feb 2002 16:51:08 +0000 |
| Subject: | Re: Ok another update | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-16610@lists.php.net to get a copy of this message | ||
Jennifer...
$query="select name, days from wt_users where uid=$uid";
change to:
$query="SELECT name, days FROM wt_users WHERE uid=\"$uid\" ";
You also need to make sure the page that is calling this script has a valid
value of $uid otherwise it won't work.
"Jennifer Downey" <jendowney@attbi.com> wrote in message
news:20020207084807.42365.qmail@pb1.pair.com...
> Hi Everyone,
>
> I want to first thank you for helping with the last question I had. It
> didn't help but I finally figured it out. This one though has me stumped.
>
> I have started using a portal script thinking I might be able to see a
> little better how php works. It will do fine for me as far as my site will
> go. But here is the problem. I want to tell a user how many days they have
> left until a certain thing happens. The portal is phpwebthings so if
anyone
> is familiar with it...
>
>
>
> The problem is I can't figure out how to get the username from the
database
> here is the code I am trying to make work.
>
>
> <?
> $db["days"]=("UPDATE wt_users set days = days - 1 where uid=$uid");
> $result=mysql_query($db["days"]);
>
> $query="select name, days from wt_users where uid=$uid";
> $ret = mysql_query($query);
> while(list($name, $days) = mysql_fetch_row($ret))
>
>
> print("$name you have $days days to complete your questionnaire");
> ?>
>
> I can't get it to work unless I specify a specific user. Like
$query="select
> name, days from wt_users where uid=1";
>
> How do I pull the user from the session? Also when I do specify a user and
> refresh the page it updates the count down how do I get it to only update
> once
> a day.
>
> Any help would be appreciated!
> Thanks
> Jennifer Downey
>
>
>
>
>
>
>