php-windows Digest 12 Sep 2005 22:36:54 -0000 Issue 2770
Topics (messages 26313 through 26320):
Not getting correct results from $_POST
26313 by: Alf Stockton
26314 by: Mark Rees
26315 by: Mark Rees
26316 by: Luis Moreira
26317 by: Alf Stockton
Misunderstanding mssql_query in the manual
26318 by: Alf Stockton
26319 by: Darvin Andrioli
26320 by: M. Sokolewicz
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Please suggest what I have done wrong with the following lines of php:-
$MachineNum = $_POST['led']; // led is the variable in the html that calls
this php
$SQL = sprintf("select a_date, a_time, amnt from register where mac_name
= %s and message_id = 34 or message_id = 35 order by a_date desc, a_time
desc", $MachineNum);
when I attempt to see what is in $SQL via a printf I get
select a_date, a_time, amnt from jackpot_register where mac_name = ''
and message_id = 34 or message_id = 35 order by a_date desc, a_time desc
I suspect that my C programming roots are showing but after a few hours of
looking I am just getting frustated.
I have tried printing and there is nothing in $MachineNum and $_REQUEST & $_GET
gives the same result, nothing.
I have also checked the HTML page that does the call and it definately says
method="post"
--
Regards,
Alf Stockton www.stockton.co.za
In the stairway of life, you'd best take the elevator.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
> Please suggest what I have done wrong with the following lines of php:-
>
> $MachineNum = $_POST['led']; // led is the variable in the html that
calls this php
>
> $SQL = sprintf("select a_date, a_time, amnt from register where mac_name
> = %s and message_id = 34 or message_id = 35 order by a_date desc, a_time
> desc", $MachineNum);
>
> when I attempt to see what is in $SQL via a printf I get
>
> select a_date, a_time, amnt from jackpot_register where mac_name = ''
> and message_id = 34 or message_id = 35 order by a_date desc, a_time desc
>
> I suspect that my C programming roots are showing but after a few hours of
looking I am just getting frustated.
>
> I have tried printing and there is nothing in $MachineNum and $_REQUEST &
$_GET gives the same result, nothing.
>
> I have also checked the HTML page that does the call and it definately
says method="post"
>
Are you sure? The PHP looks OK. Are you submitting a form with the "led" in
it?
> --
>
> Regards,
> Alf Stockton www.stockton.co.za
>
> In the stairway of life, you'd best take the elevator.
>
> My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
Please use reply-all to make sure that your message goes to the list
----- Original Message -----
From: "Luis Moreira" <[EMAIL PROTECTED]>
To: "'Mark Rees'" <[EMAIL PROTECTED]>
Sent: Monday, September 12, 2005 3:15 PM
Subject: RE: [PHP-WIN] Re: Not getting correct results from $_POST
> Mark,
>
> If you are using the correct method, then probably you are using a
> wrong NAME.
> You must have a field called "led" in the form you submit with the
> post.
>
> Luis
>
> -----Original Message-----
> From: Mark Rees [mailto:[EMAIL PROTECTED]
> Sent: segunda-feira, 12 de Setembro de 2005 14:50
> To: [email protected]
> Subject: [PHP-WIN] Re: Not getting correct results from $_POST
>
> > Please suggest what I have done wrong with the following lines of
> > php:-
> >
> > $MachineNum = $_POST['led']; // led is the variable in the html that
> calls this php
> >
> > $SQL = sprintf("select a_date, a_time, amnt from register where
> > mac_name = %s and message_id = 34 or message_id = 35 order by a_date
> > desc, a_time desc", $MachineNum);
> >
> > when I attempt to see what is in $SQL via a printf I get
> >
> > select a_date, a_time, amnt from jackpot_register where mac_name = ''
> > and message_id = 34 or message_id = 35 order by a_date desc, a_time
> > desc
> >
> > I suspect that my C programming roots are showing but after a few
> > hours of
> looking I am just getting frustated.
> >
> > I have tried printing and there is nothing in $MachineNum and
> > $_REQUEST &
> $_GET gives the same result, nothing.
> >
> > I have also checked the HTML page that does the call and it definately
> says method="post"
> >
>
> Are you sure? The PHP looks OK. Are you submitting a form with the "led"
in
> it?
>
> > --
> >
> > Regards,
> > Alf Stockton www.stockton.co.za
> >
> > In the stairway of life, you'd best take the elevator.
> >
> > My email disclaimer is available at www.stockton.co.za/disclaimer.html
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
You are welcome
-----Original Message-----
From: Mark Rees [mailto:[EMAIL PROTECTED]
Sent: segunda-feira, 12 de Setembro de 2005 15:21
To: [email protected]
Subject: Re: [PHP-WIN] Re: Not getting correct results from $_POST
Please use reply-all to make sure that your message goes to the list
----- Original Message -----
From: "Luis Moreira" <[EMAIL PROTECTED]>
To: "'Mark Rees'" <[EMAIL PROTECTED]>
Sent: Monday, September 12, 2005 3:15 PM
Subject: RE: [PHP-WIN] Re: Not getting correct results from $_POST
> Mark,
>
> If you are using the correct method, then probably you are using a
> wrong NAME.
> You must have a field called "led" in the form you submit with the
> post.
>
> Luis
>
> -----Original Message-----
> From: Mark Rees [mailto:[EMAIL PROTECTED]
> Sent: segunda-feira, 12 de Setembro de 2005 14:50
> To: [email protected]
> Subject: [PHP-WIN] Re: Not getting correct results from $_POST
>
> > Please suggest what I have done wrong with the following lines of
> > php:-
> >
> > $MachineNum = $_POST['led']; // led is the variable in the html that
> calls this php
> >
> > $SQL = sprintf("select a_date, a_time, amnt from register where
> > mac_name = %s and message_id = 34 or message_id = 35 order by a_date
> > desc, a_time desc", $MachineNum);
> >
> > when I attempt to see what is in $SQL via a printf I get
> >
> > select a_date, a_time, amnt from jackpot_register where mac_name = ''
> > and message_id = 34 or message_id = 35 order by a_date desc, a_time
> > desc
> >
> > I suspect that my C programming roots are showing but after a few
> > hours of
> looking I am just getting frustated.
> >
> > I have tried printing and there is nothing in $MachineNum and
> > $_REQUEST &
> $_GET gives the same result, nothing.
> >
> > I have also checked the HTML page that does the call and it
> > definately
> says method="post"
> >
>
> Are you sure? The PHP looks OK. Are you submitting a form with the "led"
in
> it?
>
> > --
> >
> > Regards,
> > Alf Stockton www.stockton.co.za
> >
> > In the stairway of life, you'd best take the elevator.
> >
> > My email disclaimer is available at
> > www.stockton.co.za/disclaimer.html
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>
--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Mark Rees wrote:
Please suggest what I have done wrong with the following lines of php:-
$MachineNum = $_POST['led']; // led is the variable in the html that
For some reason, despite what was in the html, I had to use $_GET
Problem solved, thanks for the help.
--
Regards,
Alf Stockton www.stockton.co.za
Q: Why was Stonehenge abandoned?
A: It wasn't IBM compatible.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
I am apparently misunderstanding the mssql_query entry in the manual.
The manual reads:-
Returns: A MS SQL result resource on success, *TRUE* if no rows were
returned, or *FALSE* on error.
From that I believe that if I test result for TRUE I should report a no
data available and if FALSE display a system errror
So my code reads:-
$SQL = sprintf("select a_date, a_time, amnt from register where
mac_name = '%s' and message_id = 34 or message_id = 35 order by a_date
desc, a_time desc", $MachineNum);
$rs = mssql_query($SQL, $link) or trigger_error(sprintf('Query
failed: %s', mysql_error()), E_USER_ERROR);
if(($rs = TRUE)) {
trigger_error (sprintf("No data exists for machine %s",
$MachineNum),E_USER_ERROR);
die;
}
No matter what is entered I always get "No data exists......."
Please tell me what I am misunderstanding.
--
Regards,
Alf Stockton www.stockton.co.za
Q: Why was Stonehenge abandoned?
A: It wasn't IBM compatible.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
> -----Messaggio originale-----
> Da: Alf Stockton [mailto:[EMAIL PROTECTED]
> Inviato: lunedì 12 settembre 2005 17.45
[...]
> So my code reads:-
>
> if(($rs = TRUE)) {
^ ^ ^
Is it your code or do you forget many "=" in the example?
It should be if(($rs === TRUE))
Darvin
--- End Message ---
--- Begin Message ---
Darvin Andrioli wrote:
-----Messaggio originale-----
Da: Alf Stockton [mailto:[EMAIL PROTECTED]
Inviato: lunedì 12 settembre 2005 17.45
[...]
So my code reads:-
if(($rs = TRUE)) {
^ ^ ^
Is it your code or do you forget many "=" in the example?
It should be if(($rs === TRUE))
Darvin
Just as a note to what went wrong:
What happens here is that you evaluate the result of an assignment,
which is always true. So it will always perform the if(), no matter what
the value of $rs is.
- tul
--- End Message ---