RE: [PHP] Still error messages!!

2004-01-28 Thread Damon Hill
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 :
> >
> > >
> >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
>
> ?>   echo $query1;
> echo $query2;
> echo $query3;
> ?>  
> 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



RE: [PHP] Passing POST variables w/out a FORM submit

2003-11-13 Thread Damon Hill
Ok, after looking over the code to do the POST manually on your website
Chris, I think I haven't been clear on what needs to happen. I
apologize.

A web browser executes the following code:

http://..com/~damon/stvalerydown
s/docs/ww   w/flash/platMap.php?getPlatList=true">
http://.x.com/~damon/docs/www/flas
h/platMap.php?getPlatList=true" quality=high
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_P
rod_Version=ShockwaveFlash" type="application/x-shockwave-flash"
width="698" height="550">

Now, when the page executes the code, the return value from the
platMap.php should be a POST or a GET response that contains the pData
variable. The platMap.php script creates the pData variable and then
needs to send it back to the flash movie in the POST or GET response. 

Hopefully that makes a little more sense. Also, your site may describe
how to do this and I am just no getting it. If that is the case I
apologize in advance for my ignorance.

Thanks.
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: Chris Shiflett [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 13, 2003 3:41 PM
To: Damon Hill; '[EMAIL PROTECTED]'
Subject: Re: [PHP] Passing POST variables w/out a FORM submit

--- Damon Hill <[EMAIL PROTECTED]> wrote:
> I am not privy to how to create the POST or GET response without a
> FORM.

GET is easy, because you can just use fopen to open a remote URL just as
if it were a local file, so long as this is set in your php.ini:

allow_url_fopen = On

As for POST, there are a number of options. You can use cURL, any of the
PEAR classes that allow you to make HTTP requests, or you can do it
manually:

http://shiflett.org/hacks/php/http_post

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

-- 
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] Passing POST variables w/out a FORM submit

2003-11-13 Thread Damon Hill
Good day!
 
I am reposting this and writing it a little differently so that maybe it is
a little clearer what I am attempting to accomplish.
 
I have a flash movie which accesses a MySQL database to retrieve coordinates
for a map containing lots for a given subdivision.
However, the connection between the flash movie and the database was not
available when the project was handed over to me.
The flash code can not be modified and it expects a given variable to be
returned from the call to the PHP script.
This variable should be in either a GET or POST response and will contain
the plot number and acreage. 
I have the PHP script written, however, I am not privy to how to create the
POST or GET response without a FORM.
 
If there is some way to accomplish this, please let me know.
Thanks in advance for the help.
 
Cheers,
M Damon Hill
Senior Technical Lead
IFWORLD, Inc.
www.ifworld.com <http://www.ifworld.com> 
479-582-5100
Go Hogs!
"Football is just a game; Eternity is forever. Nonetheless, BEAT NEW MEXICO
STATE!!!
 


[PHP] creating a POST response to pass arguments to another file

2003-11-13 Thread Damon Hill
Good day.
 
This is probably a very simple and easy question and I apologize if it
wastes the lists time.
However, I have a flash movie that is accessing a PHP script.
The PHP script is retrieving values from a database and then creating either
a GET or POST response to pass the value BACK to flash.
 
I have no control over the flash code as I am coming in as a third party for
it.
However, I have written the PHP script, but just need to know how to
construct the GET or POST response to send back to the flash movie.
 
Thanks in advance.
 
M Damon Hill
Senior Technical Lead
IFWORLD, Inc.
www.ifworld.com <http://www.ifworld.com> 
479-582-5100