Re: Still error messages!!

From: Date: Wed, 28 Jan 2004 18:34:55 +0000
Subject: Re: Still error messages!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176091@lists.php.net to get a copy of this message
I assume you are using another page with a form to enter the username and password? If so: add as the first line of your script right after the <?PHP phpinfo(); Run your application, scroll to the bottom and look at the "php variables" and make sure that your are asking for $_GET["Username"] and $_GET["Password"] are what the script sees If not: You may have to run just that page with http://whatever/whatever.php?Username=whatever&Password=whatever to see if the problem is in the form or not -Dave At 01:08 PM 1/28/2004, Radwan Aladdin wrote:
I made that.. but there is something strange!! I SELECTED field from the database.. but it is not showing what it contains!! This is what is shown on the screen : UPDATE accounts SET LogoutTime=1075313199SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='' AND Password=''UPDATE accounts SET LessonNumber=LessonNumber + 1 Query error: You have an error in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1 So what is wrong!!!?? Everything is inserted and updated correctly in the database.. but the distance is the same.. no changes.. no updates!! Regards.. ----- Original Message ----- From: "Damon Hill" <damon@nwark.com> To: "'Radwan Aladdin'" <raladin@emirates.net.ae>; <php-general@lists.php.net> Sent: Wednesday, January 28, 2004 9:56 PM Subject: RE: [PHP] Still error messages!! 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:raladin@emirates.net.ae] Sent: Wednesday, January 28, 2004 11:50 AM To: php-general@lists.php.net 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" <dobrien@naccrra.org> To: "Radwan Aladdin" <raladin@emirates.net.ae>; <php-general@lists.php.net> 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


« previous php.general (#176091) next »