Correct Radwan, you are NOT trying to echo the queries to the screen.
However, what David is trying to teach you is simply debugging
techniques.
By echoing the actual query that the PHP pareser is using, you can see
if it is indeed what you want it to be.
This way, you can debug the code yourself, instead of posting it to a
list for help.
That way you cut down on the number of email messages I receive and also
learn something in the process.

Now, echo it to the screen and see what it says :-)

M Damon Hill
Senior Technical Lead
IFWorld, Inc.
www.ifworld.com
Go Hogs!
"People demand freedom of speech to make up for the freedom of thought
which they avoid." 
- Soren Aabye Kierkegaard


-----Original Message-----
From: Radwan Aladdin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 28, 2004 11:50 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Still error messages!!


Thank for your reply..

But I'm not trying to echo these queries.. What I'm trying to do is :

To UPDATE  a value in the database (Login_Time and Logout_Time) and then
caculate the distance between them and put it in (Distance) field.. then
after that program the PHP file and put in it a LessonLimit value.. if
the LessonLimit is the same of the Distance.. then make a value in that
row
(LessonNumber) = Its currently value + 1 (So for example : is
LessonNumber = 2 then it must be 3...Etc..)

Hope you got my meaning..

The error that is displayed always is : "Query error: You have an error
in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1"

Also when I put the right UserName and Password.. the same error!!

So also there are some other errors.. please see the whole script..

Waiting your help..
Regards..

----- Original Message -----
From: "David OBrien" <[EMAIL PROTECTED]>
To: "Radwan Aladdin" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, January 28, 2004 9:35 PM
Subject: Re: [PHP] Still error messages!!


> At 12:08 PM 1/28/2004, Radwan Aladdin wrote:
> >Hello all..
> >
> >This is the PHP code :
> >
> ><?php
> >
> >include("Config.php");
> >
> >$link = mysql_connect("$user_hostname", "$user_username",
"$user_password");
> >mysql_select_db("$user_database", $link);
> >
> >$UserName = $_GET['UserName'];
> >$Password = $_GET['Password'];
> >$LogoutTime = date("U");
> >
> >$query1 = "UPDATE accounts SET LogoutTime=$LogoutTime"; $query2 = 
> >"SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE 
> >UserName='$UserName' AND Password='$Password'"; $query3 = "UPDATE 
> >accounts SET LessonNumber=LessonNumber + 1";
>
>
> right here do a
>
> ?> <pre> <?
> echo $query1;
> echo $query2;
> echo $query3;
> ?> </pre> <?
>
> and make sure the queries are what you want them to be...
>
> >$result = mysql_query($query1) or die("Query error: " . 
> >mysql_error());
> >
> >
> >$RightLoginTime = 'LoginTime';
> >$Distance = 'Distance';
> >$LessonNumber = 'LessonNumber';
> >$LessonsTimeLimit = "30";
> >
> >$query4 = "UPDATE accounts SET (Distance='" . $LogoutTime - 
> >$RightLoginTime . "') WHERE UserName=" . $UserName . " AND Password="

> >. $Password . ")";
>
> Do the same here for query4
>
> >$result2 = mysql_query($query4) or die("Query error: " . 
> >mysql_error());
> >
> >if($Distance == $LessonsTimeLimit){
> >     $result3 = mysql_query($query3) or die("Query error: " .
mysql_error());
> >}else{
> >     echo "Not yet!";
> >}
> >
> >?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to