|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 29 Jan 2004 06:28:05 -0000 Issue 2558
php-general-digest-help
lists.php.net
Date: Thu Jan 29 2004 - 00:28:05 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 29 Jan 2004 06:28:05 -0000 Issue 2558
Topics (messages 176083 through 176163):
Re: Still error messages!!
176083 by: Radwan Aladdin
176085 by: Damon Hill
176087 by: Radwan Aladdin
176091 by: David OBrien
176093 by: Radwan Aladdin
176094 by: John W. Holmes
176095 by: David OBrien
176097 by: Radwan Aladdin
176098 by: David OBrien
176101 by: John W. Holmes
176105 by: John Nichel
176106 by: John Nichel
176108 by: Radwan Aladdin
176113 by: David OBrien
176122 by: Radwan Aladdin
Re: &
176084 by: Gerard Samuel
176092 by: John W. Holmes
176103 by: Gerard Samuel
Re: Variables not working!
176086 by: Alvaro Zuniga
(WEIRD problem) Not following directories!!! (0t)
176088 by: Ryan A
176090 by: Ryan A
Re: Session time-out value
176089 by: Pushpinder Singh
Re: arrays in a class
176096 by: jazzman.exdomain.org
sending a hex string as it is?
176099 by: Khoa Nguyen
176100 by: David OBrien
176102 by: Khoa Nguyen
176112 by: DvDmanDT
176115 by: David OBrien
Re: Making Graph / Chart
176104 by: unkno me
Performance of multidimensional arrays vs many variables
176107 by: John Schulz
176116 by: Eric Bolikowski
working with files
176109 by: tony
176110 by: Matt Matijevich
176111 by: DvDmanDT
176114 by: tony
176118 by: DvDmanDT
176120 by: John Nichel
176133 by: Gryffyn, Trevor
SOLVED:- (WEIRD problem) Not following directories!!! (0t)
176117 by: Ryan A
Copyrighting PHP, MySql, Apache,perl etc...
176119 by: Ryan A
176121 by: John Nichel
Re: path problems
176123 by: Scott Taylor
176137 by: Stuart
176142 by: Scott Taylor
Ideas Kindly
176124 by: Stephen Craton
176139 by: Stuart
176146 by: Stephen Craton
176160 by: Stephen Craton
CGI ERROR
176125 by: Dale Hersh
cgi error --- please help
176126 by: Dale Hersh
176129 by: Len Borowski
176140 by: Gryffyn, Trevor
Print All parameters
176127 by: Mike Mapsnac
176131 by: DvDmanDT
PHP to Exim?
176128 by: Jas
176132 by: Brent Baisley
176135 by: Jas
Re: PHP EDITORS
176130 by: Gryffyn, Trevor
176154 by: Ralph
176163 by: Eric Bolikowski
Re: Using unset with $_SESSION
176134 by: Gryffyn, Trevor
Job Opening: N Dallas
176136 by: Birkholz, James
Re: Why we love Microsoft (0t)
176138 by: Alex King
Re: Cacheing data form PHP script
176141 by: Gryffyn, Trevor
176143 by: daniel.electroteque.org
176144 by: daniel.electroteque.org
176145 by: Gryffyn, Trevor
176148 by: daniel.electroteque.org
176149 by: daniel.electroteque.org
176150 by: daniel.electroteque.org
176152 by: daniel.electroteque.org
Aproach to based PHP authentication
176147 by: Fernando M. Maresca
Sessions not working.
176151 by: Jeff McKeon
custom session problem with 4.1.2
176153 by: cyril
PCRE vs. POSIX-extended for regular expressions
176155 by: SLanger.spirit21.de
Re: How to prevent duplicated values?
176156 by: SLanger.spirit21.de
OT, Maybe: Question Re: Apache/Macintosh Platform
176157 by: stiano.optonline.net
176161 by: - Edwin -
176162 by: Freedomware
Re: Cacheing data form PHP script - Test results
176158 by: daniel.electroteque.org
Re: Class performance was Cacheing data form PHP script
176159 by: daniel.electroteque.org
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
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
>
attached mail follows:
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
attached mail follows:
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
>
attached mail follows:
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
> >
attached mail follows:
I'm using the GET method..
And it is right.. it shows the correct GET method.. the problem in is in the Destance value.. it is not updating this value to the database.. or it is wrong.. every time = 0
So what is the error?
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 10:34 PM
Subject: Re: [PHP] Still error messages!!
> 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
> > >
>
>
attached mail follows:
From: "Radwan Aladdin" <raladin
emirates.net.ae>
> I made that.. but there is something strange!!
It's strange you can't follow instructions...
> 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
If you had printed out all the queries, you'd realize that error is coming
from $query4.
> > > > $query4 = "UPDATE accounts SET (Distance='" . $LogoutTime -
> > > > $RightLoginTime . "') WHERE UserName=" . $UserName . " AND
Password="
> > > >. $Password . ")";
$UserName and $Password have no value. Your "distance" calculation doesn't
make any sense, either, as you're subtracting a string from an integer...
> > > $LogoutTime = date("U");
> > > $RightLoginTime = 'LoginTime';
So you're setting distance equal to 1034566 - "LoginTime" (for example),
which is just going to come out to $LogoutTime (since a string converted to
an integer is zero in this case).
---John Holmes...
attached mail follows:
In your script you have
$RightLoginTime = 'LoginTime';
$Distance = 'Distance';
$LessonNumber = 'LessonNumber';
$LessonsTimeLimit = "30";
So $Distance is a string equaling "Distance" and $LessonNumber = "LessonNumber"
How are you performing math on a string?
-Dave
At 01:42 PM 1/28/2004, Radwan Aladdin wrote:
>I'm using the GET method..
>
>And it is right.. it shows the correct GET method.. the problem in is in
>the Destance value.. it is not updating this value to the database.. or it
>is wrong.. every time = 0
>
>So what is the error?
>
>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 10:34 PM
>Subject: Re: [PHP] Still error messages!!
>
>
> > 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
> > > >
> >
> >
attached mail follows:
But I mean by $RightLoginTime = 'LoginTime';
the selected field from the database (LoginTime).. First I selected the
LoginTime from the database and now I'm trying to name a variable for it to
use it..
So what is the correct code?
Regards..
--------------------------------------------------
SASSINC Internet Solutions - Arabic Department
raladin
emirates.net.ae
http://www.SASSINC.Net
----- Original Message -----
From: "John W. Holmes" <holmes072000
charter.net>
To: "Radwan Aladdin" <raladin
emirates.net.ae>; <php-general
lists.php.net>
Sent: Wednesday, January 28, 2004 10:46 PM
Subject: Re: [PHP] Still error messages!!
> From: "Radwan Aladdin" <raladin
emirates.net.ae>
>
> > I made that.. but there is something strange!!
>
> It's strange you can't follow instructions...
>
> > 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
>
> If you had printed out all the queries, you'd realize that error is coming
> from $query4.
>
> > > > > $query4 = "UPDATE accounts SET (Distance='" . $LogoutTime -
> > > > > $RightLoginTime . "') WHERE UserName=" . $UserName . " AND
> Password="
> > > > >. $Password . ")";
>
> $UserName and $Password have no value. Your "distance" calculation doesn't
> make any sense, either, as you're subtracting a string from an integer...
>
> > > > $LogoutTime = date("U");
> > > > $RightLoginTime = 'LoginTime';
>
> So you're setting distance equal to 1034566 - "LoginTime" (for example),
> which is just going to come out to $LogoutTime (since a string converted
to
> an integer is zero in this case).
>
> ---John Holmes...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
I believe I'd start here
http://www.php.net/manual/en/function.mssql-fetch-row.php
You get the db result from your script but you do nothing with it in your
script
A whole lot more reading and coding you need to accomplish.
Good Luck
-Dave
At 01:54 PM 1/28/2004, Radwan Aladdin wrote:
>But I mean by $RightLoginTime = 'LoginTime';
>the selected field from the database (LoginTime).. First I selected the
>LoginTime from the database and now I'm trying to name a variable for it to
>use it..
>
>So what is the correct code?
>
>Regards..
>--------------------------------------------------
>SASSINC Internet Solutions - Arabic Department
>raladin
emirates.net.ae
>http://www.SASSINC.Net
>----- Original Message -----
>From: "John W. Holmes" <holmes072000
charter.net>
>To: "Radwan Aladdin" <raladin
emirates.net.ae>; <php-general
lists.php.net>
>Sent: Wednesday, January 28, 2004 10:46 PM
>Subject: Re: [PHP] Still error messages!!
>
>
> > From: "Radwan Aladdin" <raladin
emirates.net.ae>
> >
> > > I made that.. but there is something strange!!
> >
> > It's strange you can't follow instructions...
> >
> > > 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
> >
> > If you had printed out all the queries, you'd realize that error is coming
> > from $query4.
> >
> > > > > > $query4 = "UPDATE accounts SET (Distance='" . $LogoutTime -
> > > > > > $RightLoginTime . "') WHERE UserName=" . $UserName . " AND
> > Password="
> > > > > >. $Password . ")";
> >
> > $UserName and $Password have no value. Your "distance" calculation doesn't
> > make any sense, either, as you're subtracting a string from an integer...
> >
> > > > > $LogoutTime = date("U");
> > > > > $RightLoginTime = 'LoginTime';
> >
> > So you're setting distance equal to 1034566 - "LoginTime" (for example),
> > which is just going to come out to $LogoutTime (since a string converted
>to
> > an integer is zero in this case).
> >
> > ---John Holmes...
> >
> > --
> > 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
attached mail follows:
From: "Radwan Aladdin" <raladin
emirates.net.ae>
> But I mean by $RightLoginTime = 'LoginTime';
> the selected field from the database (LoginTime).. First I selected the
> LoginTime from the database and now I'm trying to name a variable for it
to
> use it..
>
> So what is the correct code?
You end up with
Distance = '12345678 - LoginTime'
and you want
Distanct = 12345678 - LoginTime
so figure it out...
---John Holmes...
attached mail follows:
Radwan Aladdin wrote:
<snip>
> So where are the errors?
>
> Waiting your help please..
>
> Regards..
>
What's the error message???
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
attached mail follows:
David OBrien wrote:
> I believe I'd start here
>
> http://www.php.net/manual/en/function.mssql-fetch-row.php
>
Or here even....
http://www.php.net/manual/en/function.mysql-fetch-row.php
;)
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
attached mail follows:
Now I fixed the error message.. but the problem is in "Distance = 0"
always.. because the LoginTime is a string.. I fetch it but the same thing!!
This is the new script :
<?php
phpinfo();
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'";
$result2 = mysql_query($query2) or die("Query error: " . mysql_error());
$row2 = mysql_fetch_row($result2);
$query3 = "UPDATE accounts SET LessonNumber=LessonNumber + 1";
$RightLoginTime = 'LoginTime';
$Distance = 'Distance';
$LessonNumber = 'LessonNumber';
$LessonsTimeLimit = "30";
?> <pre> <?
echo $query1;
echo $query2;
echo $query3;
?> </pre> <?
$query4 = "UPDATE accounts SET Distance=" . $LogoutTime - $RightLoginTime .
" - LoginTime WHERE UserName=" . $UserName . " AND Password=" . $Password .
")";
$result4 = mysql_query($query4) or die("Query error: " . mysql_error());
$row4 = mysql_fetch_row($result4);
?> <pre> <?
echo $query4;
?> </pre> <?
if($Distance == $LessonsTimeLimit){
$result3 = mysql_query($query3) or die("Query error: " . mysql_error());
}else{
echo "Not yet!";
}
?>
So why it is making the Distance value = 0 and it doen't update the value in
the database. (Because it must update the value in the database by it)
Regards..
----- Original Message -----
From: "John Nichel" <jnichel
by-tor.com>
To: "Radwan Aladdin" <raladin
emirates.net.ae>
Cc: <php-general
lists.php.net>
Sent: Wednesday, January 28, 2004 11:37 PM
Subject: Re: [PHP] Still error messages!!
> Radwan Aladdin wrote:
> <snip>
> > So where are the errors?
> >
> > Waiting your help please..
> >
> > Regards..
> >
>
> What's the error message???
>
> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
At 02:45 PM 1/28/2004, Radwan Aladdin wrote:
>Now I fixed the error message.. but the problem is in "Distance = 0"
>always.. because the LoginTime is a string.. I fetch it but the same thing!!
>
>This is the new script :
>
><?php
>
>phpinfo();
>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";
You are not executing this query anywhere in the script
>$query2 = "SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE
>UserName='$UserName' AND Password='$Password'";
>$result2 = mysql_query($query2) or die("Query error: " . mysql_error());
>$row2 = mysql_fetch_row($result2);
Great that you used this to get the results in a row but you need to
reference the row in your script
>$query3 = "UPDATE accounts SET LessonNumber=LessonNumber + 1";
Instead of
>$RightLoginTime = 'LoginTime';
use
$RightLoginTime = $row2["LoginTime"];
but you need to do a mysql_query for the $query1 and get that value frst
Instead of
>$Distance = 'Distance';
use
$Distance = $row2["Distance"];
Instead of
>$LessonNumber = 'LessonNumber';
use
$LessonNumber = $row2["LessonNumber"];
The user comments on the online manual are a very good starting
point for basic programming steps needed to accomplish a task
If you would have taken the example on that page you would have
seen the steps needed:
set your query string
execute the query
get the resultset into a variable
This is the norm for all mysql php programming just putting a
$Distance='Distance'
does not tell php that what you really want it do read the database and
place the value of
Distance into $Distance
-Dave
>$LessonsTimeLimit = "30";
>
>
>?> <pre> <?
>echo $query1;
>echo $query2;
>echo $query3;
>?> </pre> <?
>
>
>
>$query4 = "UPDATE accounts SET Distance=" . $LogoutTime - $RightLoginTime .
>" - LoginTime WHERE UserName=" . $UserName . " AND Password=" . $Password .
>")";
>$result4 = mysql_query($query4) or die("Query error: " . mysql_error());
>$row4 = mysql_fetch_row($result4);
>?> <pre> <?
>echo $query4;
>?> </pre> <?
>
>
>if($Distance == $LessonsTimeLimit){
> $result3 = mysql_query($query3) or die("Query error: " . mysql_error());
>
>}else{
> echo "Not yet!";
>}
>
>?>
>
>So why it is making the Distance value = 0 and it doen't update the value in
>the database. (Because it must update the value in the database by it)
>
>Regards..
>----- Original Message -----
>From: "John Nichel" <jnichel
by-tor.com>
>To: "Radwan Aladdin" <raladin
emirates.net.ae>
>Cc: <php-general
lists.php.net>
>Sent: Wednesday, January 28, 2004 11:37 PM
>Subject: Re: [PHP] Still error messages!!
>
>
> > Radwan Aladdin wrote:
> > <snip>
> > > So where are the errors?
> > >
> > > Waiting your help please..
> > >
> > > Regards..
> > >
> >
> > What's the error message???
> >
> > --
> > By-Tor.com
> > It's all about the Rush
> > http://www.by-tor.com
> >
> > --
> > 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
attached mail follows:
Thanks alot for your reply :) I really appreciate your help..
Upto now I made this script :
<?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";
$result1 = mysql_query($query1) or die("Query error: " . mysql_error());
$query2 = "SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE
UserName='$UserName' AND Password='$Password'";
$result2 = mysql_query($query2) or die("Query error: " . mysql_error());
$row2 = mysql_fetch_row($result2);
$query3 = "UPDATE accounts SET LessonNumber=LessonNumber + 1";
$RightLoginTime = $row2["LoginTime"];
$Distance = $row2["Distance"];
$LessonNumber = $row2["LessonNumber"];
$LessonsTimeLimit = "30";
?> <pre> <?
echo $query1;
echo $query2;
echo $query3;
?> </pre> <?
$query4 = "UPDATE accounts SET Distance='$LogoutTime - $RightLoginTime'
WHERE UserName='$UserName' AND Password='$Password'";
$result4 = mysql_query($query4) or die("Query error: " . mysql_error());
?> <pre> <?
echo $query4;
?> </pre> <?
if($Distance == $LessonsTimeLimit){
$result3 = mysql_query($query3) or die("Query error: " . mysql_error());
}else{
echo "Not yet!";
}
?>
It update everyting fine.. but the problem is that the "LoginTime" value is
not imported from the database!
So what is the problem?
Regards..
----- Original Message -----
From: "David OBrien" <dobrien
naccrra.org>
To: "Radwan Aladdin" <raladin
emirates.net.ae>; <php-general
lists.php.net>
Sent: Thursday, January 29, 2004 12:07 AM
Subject: Re: [PHP] Still error messages!!
> At 02:45 PM 1/28/2004, Radwan Aladdin wrote:
> >Now I fixed the error message.. but the problem is in "Distance = 0"
> >always.. because the LoginTime is a string.. I fetch it but the same
thing!!
> >
> >This is the new script :
> >
> ><?php
> >
> >phpinfo();
> >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";
>
> You are not executing this query anywhere in the script
>
> >$query2 = "SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE
> >UserName='$UserName' AND Password='$Password'";
> >$result2 = mysql_query($query2) or die("Query error: " . mysql_error());
> >$row2 = mysql_fetch_row($result2);
>
> Great that you used this to get the results in a row but you need to
> reference the row in your script
>
> >$query3 = "UPDATE accounts SET LessonNumber=LessonNumber + 1";
>
> Instead of
>
> >$RightLoginTime = 'LoginTime';
> use
> $RightLoginTime = $row2["LoginTime"];
>
> but you need to do a mysql_query for the $query1 and get that value frst
>
> Instead of
>
> >$Distance = 'Distance';
> use
> $Distance = $row2["Distance"];
>
> Instead of
>
> >$LessonNumber = 'LessonNumber';
> use
> $LessonNumber = $row2["LessonNumber"];
>
> The user comments on the online manual are a very good starting
> point for basic programming steps needed to accomplish a task
> If you would have taken the example on that page you would have
> seen the steps needed:
>
> set your query string
> execute the query
> get the resultset into a variable
>
> This is the norm for all mysql php programming just putting a
> $Distance='Distance'
> does not tell php that what you really want it do read the database and
> place the value of
> Distance into $Distance
>
> -Dave
>
> >$LessonsTimeLimit = "30";
> >
> >
> >?> <pre> <?
> >echo $query1;
> >echo $query2;
> >echo $query3;
> >?> </pre> <?
> >
> >
> >
> >$query4 = "UPDATE accounts SET Distance=" . $LogoutTime - $RightLoginTime
.
> >" - LoginTime WHERE UserName=" . $UserName . " AND Password=" . $Password
.
> >")";
> >$result4 = mysql_query($query4) or die("Query error: " . mysql_error());
> >$row4 = mysql_fetch_row($result4);
> >?> <pre> <?
> >echo $query4;
> >?> </pre> <?
> >
> >
> >if($Distance == $LessonsTimeLimit){
> > $result3 = mysql_query($query3) or die("Query error: " .
mysql_error());
> >
> >}else{
> > echo "Not yet!";
> >}
> >
> >?>
> >
> >So why it is making the Distance value = 0 and it doen't update the value
in
> >the database. (Because it must update the value in the database by it)
> >
> >Regards..
> >----- Original Message -----
> >From: "John Nichel" <jnichel
by-tor.com>
> >To: "Radwan Aladdin" <raladin
emirates.net.ae>
> >Cc: <php-general
lists.php.net>
> >Sent: Wednesday, January 28, 2004 11:37 PM
> >Subject: Re: [PHP] Still error messages!!
> >
> >
> > > Radwan Aladdin wrote:
> > > <snip>
> > > > So where are the errors?
> > > >
> > > > Waiting your help please..
> > > >
> > > > Regards..
> > > >
> > >
> > > What's the error message???
> > >
> > > --
> > > By-Tor.com
> > > It's all about the Rush
> > > http://www.by-tor.com
> > >
> > > --
> > > 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
>
attached mail follows:
On Wednesday 28 January 2004 10:23 am, Stuart wrote:
> Not from where I'm sitting [PHP 4.3.3RC1 (cli) (built: Jun 21 2003
> 23:40:27) on FreeBSD built from ports]. Code...
>
Hey, as least we can agree with something..... FreeBSD :)
> print str_replace('&', '&', 'Here is one & and here is another &');
>
> ... outputs ...
>
> Here is one & and here is another &
>
You're absolutely correct. I jumped the gun way too early.
My experience with replacing & with & is that if the content already
contains entity content, for example
Running str_replace will mess them up.
> Do you need more coffee?
Maybe some latte ;)
attached mail follows:
From: "Gerard Samuel" <php-general
trini0.org>
> You're absolutely correct. I jumped the gun way too early.
> My experience with replacing & with & is that if the content already
> contains entity content, for example
> Running str_replace will mess them up.
Depends how you define "mess them up"... If you want to display
literally on a web page, then you need to write &nbsp; in the source. So
this may not be messing things up but rather preparing them to be shown on a
web page, literally.
---John Holmes...
attached mail follows:
On Wednesday 28 January 2004 01:35 pm, John W. Holmes wrote:
> Depends how you define "mess them up"... If you want to display
> literally on a web page, then you need to write &nbsp; in the source.
> So this may not be messing things up but rather preparing them to be shown
> on a web page, literally.
>
> ---John Holmes...
True, but the bottom line is
&nbsp; !==
Me personally, I rather keep it in its simplest form " "
For example, if you run &nbsp; through str_replace('&', ' ', $foo)
again, it becomes even more "messed up". &amp;nbsp;
The point Im trying to make, is to watch out using str_replace() to convert &
to & or something else thats similar, because, one may end up with a
situation where they have content like &amp;nbsp; on their hands.
attached mail follows:
Try this for a generic fix if it is the globals issue:
Place this somewhere to set to TRUE or FALSE when needed
$GLOBAL_FIX = TRUE;
use an include on every script:
if($GLOBAL_VARS_FIX) {
if( phpversion() >= '4.2.0' ) {
extract($_POST);
extract($_GET);
extract($_SERVER);
extract($_ENV);
extract($_COOKIE);
}
}
---
Alvaro Zuniga
Information Technology Professional
(337) 654 6515
www.zunitek.com
attached mail follows:
Hi,
Heres a totally weird problem, I created some folders on our server (which
we are accessing only via ip as the domain has not been resolved) but I get
an error when i try to access the folder(s)!
eg:
(I created this folder)
ryan
and i try to access it like this:
http://208.234.29.220/ryan/
and it gives me this error: "You don't have permission to access /ryan/ on
this server."
Which is totally weird coz I have NOTHING in that folder right now...not
even a .htaccess file
What could be wrong? I have looked in my httpd.conf file and on google but
cant seem to find
anything...any ideas?
Thanks,
-Ryan
attached mail follows:
Hey Andrew,
> First, note that that is an apache problem, not PHP.
Yep, thats why I put the "Ot" in the subject line.... but since you cant
have PHP
without a webserver and apache is the most popular on the list or the
net...I was
hopeing someone else had this problem and could guide me
> In httpd.conf add "Option Indexes" to the folder (root for whole site).
> That will produce a file list of the directory.
Thanks, will try that right now.
> Or, put in a 'default' document (ie: index.html) that will produce the
> output when people browse to the directory.
Will try that too.
> Directory browsing is normaly disabled in web servers (from experience,
> apache and IIS).
See? didnt know that. Learned something new.
> HTH
Sure did. Thanks.
Cheers,
-Ryan
> Andrew
>
Hi,
> > Heres a totally weird problem, I created some folders on our server
> (which
> > we are accessing only via ip as the domain has not been resolved) but I
> > get
> > an error when i try to access the folder(s)!
> >
> > eg:
> > (I created this folder)
> > ryan
> >
> > and i try to access it like this:
> > http://208.234.29.220/ryan/
> >
> > and it gives me this error:
> "You don't have permission to access /ryan/ on
> > this server."
> >
> > Which is totally weird coz I have NOTHING in that folder right now...
> not
> > even a .htaccess file
> >
> > What could be wrong? I have looked in my httpd.conf file and on google
> but
> > cant seem to
attached mail follows:
Yes, I have used a .htaccess file in a Web Directory to prevent http
access to its contents.
Thanks again !!
-Pushpinder Singh
On Saturday, January 24, 2004, at 12:59 AM, Jason Wong wrote:
> On Saturday 24 January 2004 05:46, Pushpinder Singh wrote:
>
>> I tried to keep a .htaccess file in the Dir that my application
>> esided in and kept the session lifetime of about 8 hrs. However I
>> checked to see after 2 hr and it had already kicked me out of the
>> system. Please advise.
>
> Does your hosting service allow you to use .htaccess files?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> You can't fall off the floor.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On Wed, 28 Jan 2004 tinu
humbapa.ch wrote:
> in php you have to access a member variable (or methods) with:
> $this->varname (without the "$")
>
> e.g.: $this->includedFile = array();
>
> hope this helps
AHA! I think that's it. The comment someone sent to me (Sorry, i'm awful
with names) about $this->$includeFiles=array() maybe corrupting all of
$this apparently seemed true.
Thanks again all :)
Marc
attached mail follows:
$var = 0x8180;
How do I send $var to the browser as it is? In other words, if sniffing on
the wire, I should see 8180, not 38 31 38 30.
Thanks for your help.
Khoa
attached mail follows:
At 02:03 PM 1/28/2004, Khoa Nguyen wrote:
>$var = 0x8180;
>
>How do I send $var to the browser as it is? In other words, if sniffing on
>the wire, I should see 8180, not 38 31 38 30.
I think
http://www.php.net/manual/en/function.strval.php
would work here
-Dave
>Thanks for your help.
>Khoa
>
>--