Re: [PHP] Switch Statement

2013-09-29 Thread Aziz Saleh
What is the output? On Sun, Sep 29, 2013 at 1:34 AM, Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote: On 09/28/2013 10:53 PM, Aziz Saleh wrote: Ethan, can you do a var_dump instead of print_r. It might be that next_step has spaces in it causing the switch to not match. Aziz

Re: [PHP] Switch Statement

2013-09-29 Thread mrfroasty
Hello, I suggest you put default in that switch statement and var_dump the $_POST.That should be enough for a programmer to pin point what goes wrong. P:S **You might want to consider versioning your codes to go back into its history to see what has changed. Muhsin On 09/29/2013 04:33 AM,

Re: [PHP] Switch Statement

2013-09-28 Thread Aziz Saleh
Ethan, can you do a var_dump instead of print_r. It might be that next_step has spaces in it causing the switch to not match. Aziz On Sat, Sep 28, 2013 at 10:33 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote: Dear List - I have a working program. I made one change in a switch

Re: [PHP] Switch Statement

2013-09-28 Thread Ethan Rosenberg
On 09/28/2013 10:53 PM, Aziz Saleh wrote: Ethan, can you do a var_dump instead of print_r. It might be that next_step has spaces in it causing the switch to not match. Aziz snip Aziz - Used var_dump no further information Ethan -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Jonathan Sundquist
Since you already have the return statement with the if statement the else isn't required. If those three statements are true you would exit the call any ways On Mar 11, 2013 4:33 PM, Angela Barone ang...@italian-getaways.com wrote: I'm looking for an 'unless' statement, but as far as I

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Ashley Sheridan
On Mon, 2013-03-11 at 16:38 -0500, Jonathan Sundquist wrote: Since you already have the return statement with the if statement the else isn't required. If those three statements are true you would exit the call any ways On Mar 11, 2013 4:33 PM, Angela Barone ang...@italian-getaways.com

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Angela Barone
On Mar 11, 2013, at 2:38 PM, Jonathan Sundquist wrote: Since you already have the return statement with the if statement the else isn't required. If those three statements are true you would exit the call any ways I don't follow. The else contains the meat of the statement.

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Jonathan Sundquist
What you have if ( ($current_page == $saved_page) and ($current_ip == $saved_ip) and ($current_dt ($saved_dt + 3600)) ) { return; } else { $query = UPDATE `table` SET `hits` = '$count', `agent` = '$agent', `ts` = '$date_time' WHERE `page` = '$page'; $result =

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Angela Barone
On Mar 11, 2013, at 3:47 PM, Ashley Sheridan wrote: if ( !( ($current_page == $saved_page) and ($current_ip == $saved_ip) and ($current_dt ($saved_dt + 3600)) ) ) Hello Ash, This makes sense to me, but I can't get it to work, so I'm either not understanding it or I'm asking the

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Jonathan Sundquist
Angela, the variable $current_page does not exist. so $curent_page does not equal $saved_page. Also the ! in front of the entire statement means that all of this is false. Since one items is true and not true = false Don't save is echoed out. If you are looking to save the results based on the

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Angela Barone
On Mar 11, 2013, at 4:10 PM, Jonathan Sundquist wrote: the variable $current_page does not exist. That was my problem. :( I've been staring at this for too long. Too bad there's not a 'use strict' pragma. I would also suggest keeping with your original statement to return early and

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Larry Garfield
On 3/11/13 6:25 PM, Angela Barone wrote: On Mar 11, 2013, at 4:10 PM, Jonathan Sundquist wrote: the variable $current_page does not exist. That was my problem. :( I've been staring at this for too long. Too bad there's not a 'use strict' pragma. There is. Always set your

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Try putting tick marks (`) around the field and table names. So your SQL query would then look like: INSERT INTO `history` (`v_id`, `hour`, `visits`, `date`) VALUES (45, 0, 59, '2010 01 27'); This is a good practice to get into. The problem is that MySQL allows you to create tables and

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Kim Madsen
james stojan wrote on 11/02/2010 22:21: $query=INSERT INTO upload_history (v_id,hour,visits,date) VALUES (.$v_id.,.$hour.,.$visits.,'$date1'.);; The ,'$date1'. is not correct syntax, change it to ,'.$date.' -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Mari Masuda
Also, in PHP you should NOT put the last semi-colon at the end of your SQL statement. http://www.php.net/manual/en/function.mysql-query.php On Feb 11, 2010, at 1:26 PM, Joseph Thayne wrote: Try putting tick marks (`) around the field and table names. So your SQL query would then look like:

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread james stojan
Thank you. You were right on the money, hour was the problem and the tick marks solved it. I spent 3 hours trying to figure out why I never got an error but there was no insert and php myadmin does add the tick marks automatically. Probably a good habit to always use the tick marks. Learn

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Actually, the syntax is just fine. I personally would prefer it the way you mention, but there actually is nothing wrong with the syntax. The ,'$date1'. is not correct syntax, change it to ,'.$date.' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 8:27 AM, Joseph Thayne webad...@thaynefam.org wrote: Actually, the syntax is just fine.  I personally would prefer it the way you mention, but there actually is nothing wrong with the syntax. The ,'$date1'. is not correct syntax, change it to ,'.$date.' My personal

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
That is a good idea to use the curly braces. I consistently forget about them, and fell like an idiot every time I am reminded of them. As for the backticks, they are required because of MySQL, not because of phpMyAdmin. The issue was not that phpMyAdmin uses backticks, it is that MySQL

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Jochem Maas
Op 2/11/10 10:51 PM, James McLean schreef: On Fri, Feb 12, 2010 at 8:27 AM, Joseph Thayne webad...@thaynefam.org wrote: Actually, the syntax is just fine. I personally would prefer it the way you mention, but there actually is nothing wrong with the syntax. The ,'$date1'. is not correct

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 9:31 AM, Jochem Maas joc...@iamjochem.com wrote: Op 2/11/10 10:51 PM, James McLean schreef: My personal preference these days is to use Curly braces around variables in strings such as this, I always find excessive string concatenation such as is often used when

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne webad...@thaynefam.org wrote: As for the backticks, they are required because of MySQL, not because of phpMyAdmin.  The issue was not that phpMyAdmin uses backticks, it is that MySQL pretty much requires them when naming a field the same as an

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Yeah, I am a lot more descriptive now. I ran into it quite a bit when I was first starting out. James McLean wrote: On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne webad...@thaynefam.org wrote: As for the backticks, they are required because of MySQL, not because of phpMyAdmin. The issue

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Paul M Foster
On Fri, Feb 12, 2010 at 09:44:47AM +1030, James McLean wrote: On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne webad...@thaynefam.org wrote: As for the backticks, they are required because of MySQL, not because of phpMyAdmin.  The issue was not that phpMyAdmin uses backticks, it is that

RE: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
for you and you can then focus on other things such as data integrity and general processing speed? Joseph -Original Message- From: Paul M Foster [mailto:pa...@quillandmouse.com] Sent: Thursday, February 11, 2010 9:15 PM To: php-general@lists.php.net Subject: Re: [PHP] Mysql statement works

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Paul M Foster
On Thu, Feb 11, 2010 at 09:49:02PM -0600, Joseph Thayne wrote: I was going to write an example as to what should happen instead of what actually does when id dawned on me why MySQL works the way it does. One of the biggest complaints people have with MySQL is in speed. The much-vaunted

Re: [PHP] Switch statement Question

2009-01-30 Thread Thodoris
Hi, I have a code snippet here as in the following: //Switch statements between the four options switch($string) { case : $string= NOT book.author='All'; break; default: $string= $string . AND NOT book.author='All'; break; } This code does work, but I am wondering if it is possible in

RE: [PHP] Switch statement Question

2009-01-29 Thread Boyd, Todd M.
-Original Message- From: Alice Wei [mailto:aj...@alumni.iu.edu] Sent: Thursday, January 29, 2009 3:02 PM To: php-general@lists.php.net Subject: [PHP] Switch statement Question Hi, I have a code snippet here as in the following: //Switch statements between the four options

Re: [PHP] Switch statement Question

2009-01-29 Thread Jochem Maas
Boyd, Todd M. schreef: -Original Message- From: Alice Wei [mailto:aj...@alumni.iu.edu] Sent: Thursday, January 29, 2009 3:02 PM To: php-general@lists.php.net Subject: [PHP] Switch statement Question Hi, I have a code snippet here as in the following: //Switch statements

Re: [PHP] prepared statement

2008-06-26 Thread ctx2002
thanks for answering my question. I have checked PHP PDO doc. PDO:: query() can send a query to server. my question is, does PDO:: query() generates prepared statement automatically? or I have to explicitly call PDO:: prepare() to use prepared statement? for example: PDO:: query(select name

Re: [PHP] prepared statement

2008-06-26 Thread Chris
ctx2002 wrote: thanks for answering my question. I have checked PHP PDO doc. PDO:: query() can send a query to server. my question is, does PDO:: query() generates prepared statement automatically? or I have to explicitly call PDO:: prepare() to use prepared statement? You have to use

Re: [PHP] prepared statement

2008-06-25 Thread Chris
ctx2002 wrote: Hi all: We are use PHP PDO's Prepared statement to send SQL query to Mysql server. According to PHP PDO doc, Prepared statement are fast for executing multiple SQL queries with same parameters. by using prepared statement you avoid repeating the analyze/compile/optimize cycle

Re: [PHP] prepared statement

2008-06-25 Thread ctx2002
I mean for each different requests/connection how can i use same prepared statements object that was generated by PDO lib/mysql Server. is Mysql server cache prepared statement plan? for example: client one connect to our site, and send a prepared statement to our mysql DB, now the DB will

Re: [PHP] prepared statement

2008-06-25 Thread Chris
ctx2002 wrote: I mean for each different requests/connection how can i use same prepared statements object that was generated by PDO lib/mysql Server. You can't. Resources/connections are done per request and can't be shared - it's done that way by design. -- Postgresql php tutorials

Re: [PHP] prepared statement

2008-06-25 Thread ctx2002
so only benefit for use prepared statement in Web environment is to prevent SQL injection? regards chris smith-9 wrote: ctx2002 wrote: I mean for each different requests/connection how can i use same prepared statements object that was generated by PDO lib/mysql Server. You

Re: [PHP] prepared statement

2008-06-25 Thread Larry Garfield
On Wednesday 25 June 2008 8:24:06 pm ctx2002 wrote: so only benefit for use prepared statement in Web environment is to prevent SQL injection? regards It's somewhat more complicated than that. (The following is based on my own experiences with PDO and a conversation with PDO's original

Re: [PHP] IF statement

2007-10-19 Thread Simon
I'd suggest a tutorial or something on BOOLEAN or LOGICAL OPERATORS. For example: true and false = false true or false = true not true and not false = false not true or not false = true and so on... The IF statement will simply take the result of a logical operation, and the result will either

Re: [PHP] IF statement

2007-10-18 Thread Robert Cummings
On Thu, 2007-10-18 at 19:57 -0500, ron.php wrote: I just tried to send this to the list. I am not trying make it post again, I don't think I had the e-mail address correct the first time. I am trying to stop $component_reference from doing the echo below when the value is 5 or 19. I

Re: [PHP] IF statement

2007-10-18 Thread Carlos Martínez González
just change OR by AND. 2007/10/19, ron.php [EMAIL PROTECTED]: I just tried to send this to the list. I am not trying make it post again, I don't think I had the e-mail address correct the first time. I am trying to stop $component_reference from doing the echo below when the value is 5 or

Re: [PHP] If statement duplicating mysql records?

2007-06-21 Thread Roberto Mansfield
Jason Pruim wrote: The code I had worked out, originally was something along the lines of: if($row[5] ==Level1) ( echo TRTD bgcolor=.$Level1.$row[0] /td; echo td bgcolor=.$Level1.$row[1] /td; echo td bgcolor=.$Level1.A href='$row[2]'Instructions/A/td; echo TD

Re: [PHP] If statement duplicating mysql records?

2007-06-21 Thread Jason Pruim
On Jun 21, 2007, at 1:42 PM, Roberto Mansfield wrote: Jason Pruim wrote: The code I had worked out, originally was something along the lines of: if($row[5] ==Level1) ( echo TRTD bgcolor=.$Level1.$row[0] /td; echo td bgcolor=.$Level1.$row[1] /td; echo td bgcolor=.$Level1.A

Re: [PHP] If statement duplicating mysql records?

2007-06-21 Thread Roberto Mansfield
Jason Pruim wrote: It's not quite making sense to me though... My understanding of IF statements is if the condition is met it ignores all the other if's. Is that not correct? At this point it's just me trying to figure things out for my knowledge :) No, that's not how it works. If the

Re: [PHP] If statement duplicating mysql records?

2007-06-21 Thread Jason Pruim
On Jun 21, 2007, at 1:58 PM, Roberto Mansfield wrote: Jason Pruim wrote: It's not quite making sense to me though... My understanding of IF statements is if the condition is met it ignores all the other if's. Is that not correct? At this point it's just me trying to figure things out

Re: [PHP] If statement duplicating mysql records?

2007-06-21 Thread Jim Lucas
Jason Pruim wrote: On Jun 21, 2007, at 1:58 PM, Roberto Mansfield wrote: Jason Pruim wrote: It's not quite making sense to me though... My understanding of IF statements is if the condition is met it ignores all the other if's. Is that not correct? At this point it's just me trying to

Re: [PHP] If statement duplicating mysql records?

2007-06-20 Thread Jason Pruim
On Jun 19, 2007, at 4:20 PM, Jim Lucas wrote: Jason Pruim wrote: Okay, so I have a question... Probably pretty easy, but why would my if statement show more records then what are in the database? if($row[5] =='Level4'){ // White Highlight echo TRTD bgcolor=.$Level4.$row[0] /td;

Re: [PHP] If statement duplicating mysql records?

2007-06-20 Thread Jim Lucas
Jason Pruim wrote: On Jun 19, 2007, at 4:20 PM, Jim Lucas wrote: Jason Pruim wrote: Okay, so I have a question... Probably pretty easy, but why would my if statement show more records then what are in the database? if($row[5] =='Level4'){ // White Highlight echo TRTD

Re: [PHP] If statement duplicating mysql records?

2007-06-20 Thread Daniel Brown
On 6/20/07, Jim Lucas [EMAIL PROTECTED] wrote: I would look at your result set and see if you had multiple lines returned. One person mentioned that you might be using a JOIN in you SQL call. This could lead to multiple lines. Start investigating your SQL statement I would suggest.

Re: [PHP] If statement duplicating mysql records?

2007-06-20 Thread Jason Pruim
On Jun 20, 2007, at 10:56 AM, Daniel Brown wrote: On 6/20/07, Jim Lucas [EMAIL PROTECTED] wrote: I would look at your result set and see if you had multiple lines returned. One person mentioned that you might be using a JOIN in you SQL call. This could lead to multiple lines. Start

Re: [PHP] If statement duplicating mysql records?

2007-06-20 Thread Daniel Brown
On 6/20/07, Jason Pruim [EMAIL PROTECTED] wrote: Hey Jim, You're right it is the system you helped me get started with, Just wanted to add a little color coding for the different levels :) Here is the sql query: $sql = SELECT * FROM tasks WHERE completed='0' order by id; $sql .= AND

Re: [PHP] If statement duplicating mysql records?

2007-06-19 Thread Jim Lucas
Jason Pruim wrote: Okay, so I have a question... Probably pretty easy, but why would my if statement show more records then what are in the database? if($row[5] =='Level4'){ // White Highlight echo TRTD bgcolor=.$Level4.$row[0] /td; echo td bgcolor=.$Level4.$row[1]

Re: [PHP] PDO statement/resultset

2006-12-17 Thread Chris
David Duong wrote: Hi everyone, Let me know if there is a better place to post this. I am playing with the idea of creating a true (KISS) abstraction layer that makes full use of PHP5's OOP support. So logically it would make sense to make use PDO wherever possible, however, one of PDO's

Re: [PHP] if statement with or comparison (newbie)

2006-09-11 Thread Curt Zirzow
On 9/8/06, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2006-09-08 at 15:30 -0600, Jeremy Privett wrote: Well, it could be this, too: switch( $_REQUEST['id'] ) { case white: echo Right color.; break; case black: echo Right color.;

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Satyam
. Satyam - Original Message - From: Kevin Murphy [EMAIL PROTECTED] To: php php-general@lists.php.net Cc: JD [EMAIL PROTECTED] Sent: Friday, September 08, 2006 11:25 PM Subject: Re: [PHP] if statement with or comparison (newbie) Shouldn't that be this instead: if (($_REQUEST['id

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Mark Charette
Robert Cummings wrote: On Fri, 2006-09-08 at 18:38 -0400, tedd wrote: At 5:03 PM -0400 9/8/06, JD wrote: In all of the answers given thus far, no one mentioned that the use of $_REQUEST has a security issue with regard to where the $_REQUEST originated. $_REQUEST is an array

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Stut
Mark Charette wrote: However, looking at it from a 'knowing early the data is tainted' perspective, not from a 'validating and cleaning perspective', if you have coded that (for instance) a variable is set via COOKIE, then only looking for that variable set via COOKIE will eliminate its being

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Robert Cummings
On Sat, 2006-09-09 at 10:21 -0400, Mark Charette wrote: Robert Cummings wrote: On Fri, 2006-09-08 at 18:38 -0400, tedd wrote: At 5:03 PM -0400 9/8/06, JD wrote: In all of the answers given thus far, no one mentioned that the use of $_REQUEST has a security issue with regard

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Mark Charette
Stut wrote: Mark Charette wrote: However, looking at it from a 'knowing early the data is tainted' perspective, not from a 'validating and cleaning perspective', if you have coded that (for instance) a variable is set via COOKIE, then only looking for that variable set via COOKIE will

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Robert Cummings
On Sat, 2006-09-09 at 11:30 -0400, Mark Charette wrote: Stut wrote: Mark Charette wrote: However, looking at it from a 'knowing early the data is tainted' perspective, not from a 'validating and cleaning perspective', if you have coded that (for instance) a variable is set via COOKIE,

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Mark Charette
Robert Cummings wrote: On Sat, 2006-09-09 at 11:30 -0400, Mark Charette wrote: Stut wrote: Mark Charette wrote: However, looking at it from a 'knowing early the data is tainted' perspective, not from a 'validating and cleaning perspective', if you have coded that (for

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Stut
Mark Charette wrote: And I'll wager a brew no one here has ever done a formal, mathematically rigorous proof of a validation routine except as a class project. As a senior member of the software QC department in a major industrial company, I generally find more errors and omissions in

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Robert Cummings
On Sat, 2006-09-09 at 12:12 -0400, Mark Charette wrote: As a senior member of the software QC department in a major industrial company, I generally find more errors and omissions in validation routines during code reviews and ethical hacks than anywhere else.

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread Robert Cummings
On Sat, 2006-09-09 at 17:27 +0100, Stut wrote: Mark Charette wrote: And I'll wager a brew no one here has ever done a formal, mathematically rigorous proof of a validation routine except as a class project. As a senior member of the software QC department in a major industrial company,

Re: [PHP] if statement with or comparison (newbie)

2006-09-09 Thread tedd
At 12:29 PM -0400 9/9/06, Robert Cummings wrote: On Sat, 2006-09-09 at 12:12 -0400, Mark Charette wrote: As a senior member of the software QC department in a major industrial company, I generally find more errors and omissions in validation routines during code reviews and ethical hacks

Re: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread Prathaban Mookiah
Let me rephrase it. Your color should be black or white to be the right colour. Is this correct? In that case you should change it to if ($_REQUEST['id'] != black AND $_REQUEST['id'] != white) { echo wrong color; } else ( echo right color; } - Original

Re: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread Kevin Murphy
Shouldn't that be this instead: if (($_REQUEST['id'] != black) OR ($_REQUEST['id'] != white)) { echo wrong color; } else { echo right color; } -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu

Re: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread Mitch Miller
I think the OR should be an AND ... If $_REQUEST['id'] = black then the second test will be true and it will output wrong color. If the color is white then the same thing will happen 'cause it meets the first criteria. -- Mitch Kevin Murphy wrote: Shouldn't that be this instead:

RE: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread Jeremy Privett
: Re: [PHP] if statement with or comparison (newbie) Shouldn't that be this instead: if (($_REQUEST['id'] != black) OR ($_REQUEST['id'] != white)) { echo wrong color; } else { echo right color; } -- Kevin Murphy Webmaster: Information and Marketing

Re: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread Satyam
- Original Message - From: JD [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, September 08, 2006 11:03 PM Subject: [PHP] if statement with or comparison (newbie) I'm trying to set up a simple conditional, something like this: If my_variable is NOT equal to (black or

Re: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread JD
At 05:30 PM 9/8/2006, you wrote: - Original Message - From: JD [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, September 08, 2006 11:03 PM Subject: [PHP] if statement with or comparison (newbie) I'm trying to set up a simple conditional, something like this: If

RE: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread Robert Cummings
On Fri, 2006-09-08 at 15:30 -0600, Jeremy Privett wrote: Well, it could be this, too: switch( $_REQUEST['id'] ) { case white: echo Right color.; break; case black: echo Right color.; break; default: echo Wrong

Re: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread tedd
At 5:03 PM -0400 9/8/06, JD wrote: I'm trying to set up a simple conditional, something like this: Here is what I have tried: if ($_REQUEST['id'] != (black or white)) { In all of the answers given thus far, no one mentioned that the use of $_REQUEST has a security issue with regard to

Re: [PHP] if statement with or comparison (newbie)

2006-09-08 Thread Robert Cummings
On Fri, 2006-09-08 at 18:38 -0400, tedd wrote: At 5:03 PM -0400 9/8/06, JD wrote: I'm trying to set up a simple conditional, something like this: Here is what I have tried: if ($_REQUEST['id'] != (black or white)) { In all of the answers given thus far, no one mentioned that the

Re: [PHP] If statement question

2006-06-27 Thread Richard Lynch
On Mon, June 26, 2006 1:23 pm, Robert Cummings wrote: I can't think of any language that processes the contents of a conditional block when the test condition fails. I believe that PHP with Runkit would let you set that up to happen, if it was something you actually wanted... :-) And Common

Re: [PHP] If statement question

2006-06-26 Thread Martin Marques
On Mon, 26 Jun 2006 19:10:59 +0100, Alex Major [EMAIL PROTECTED] wrote: Hi list. Basically, I'm still learning new things about php and I was wondering if things inside an if statement get 'looked at' by a script if the condition is false. For example, would this mysql query get executed if

Re: [PHP] If statement question

2006-06-26 Thread Robert Cummings
On Mon, 2006-06-26 at 14:10, Alex Major wrote: Hi list. Basically, I'm still learning new things about php and I was wondering if things inside an if statement get 'looked at' by a script if the condition is false. For example, would this mysql query get executed if $number = 0 ? If

Re: [PHP] If statement question

2006-06-26 Thread Larry Garfield
On Monday 26 June 2006 13:10, Alex Major wrote: Hi list. Basically, I'm still learning new things about php and I was wondering if things inside an if statement get 'looked at' by a script if the condition is false. For example, would this mysql query get executed if $number = 0 ? If

Re: [PHP] select statement with variables ???

2005-12-21 Thread Robin Vickery
On 12/21/05, Anasta [EMAIL PROTECTED] wrote: Can someone tell me why this select is wrong please---ive tried everything. the $cat is the tablename . You've tried *everything* ? Why do you think it's wrong? Did you get an error message of some kind? What do you see if you echo $query? Are the

RE: [PHP] select statement with variables ???

2005-12-21 Thread Jim Moseby
Can someone tell me why this select is wrong please---ive tried everything. the $cat is the tablename . $query= SELECT title FROM $cat WHERE id='$id'; Apparently, either $cat or $id is not the value you think it is. First, I would try changing $result=mysql_query($query); to

RE: [PHP] select statement with variables ???

2005-12-21 Thread Jay Blanchard
[snip] $query= SELECT title FROM $cat WHERE id='$id'; [/snip] echo $query; // does it look right to you? Alway throw an error when in question if(!($result = mysql_query($query, $connection))){ echo mysql_error() . br\n; exit(); } My bet is that you need to concatenate $query = SELECT

Re: [PHP] select statement with variables ???

2005-12-21 Thread Jochem Maas
side-question Jay how come you though concating would give a different result to interpolation? /side-question Jay Blanchard wrote: [snip] $query= SELECT title FROM $cat WHERE id='$id'; [/snip] echo $query; // does it look right to you? Alway throw an error when in question if(!($result =

RE: [PHP] select statement with variables ???

2005-12-21 Thread Jay Blanchard
[snip] side-question Jay how come you though concating would give a different result to interpolation? /side-question [/snip] It is not really a different result, it is just something that I am in the habit of doing. The concat or not to concat question has fueled many a holy war. I concat,

Re: [PHP] select statement with variables ???

2005-12-21 Thread Jochem Maas
Jay Blanchard wrote: [snip] side-question Jay how come you though concating would give a different result to interpolation? /side-question [/snip] It is not really a different result, it is just something that I am in the habit of doing. The concat or not to concat question has fueled many a

RE: [PHP] if statement help

2005-11-04 Thread Ford, Mike
On 03 November 2005 15:26, Brent Baisley wrote: You only need one if. The parenthesis will evaluation order. if( ( !empty( $var1 ) || ( !empty( $var2 ) !empty( $var3 ) ) || $var1 == something ) However, the $var1==something test is redundant in this, since if that is true the

Re: [PHP] if statement help

2005-11-03 Thread Brent Baisley
You only need one if. The parenthesis will evaluation order. if( ( !empty( $var1 ) || ( !empty( $var2 ) !empty( $var3 ) ) || $var1 == something ) On Nov 3, 2005, at 10:13 AM, Jason Gerfen wrote: I am trying to determine if it is worth my time to attempt a if statement similar to the

Re: [PHP] conditional statement inside while loop?

2005-09-02 Thread z a p a n
Murray, Miles, Cristea Jim: Thanks a lot, I got it figured out. Peace, -z Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an

RE: [PHP] conditional statement inside while loop?

2005-09-01 Thread Jim Moseby
I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do this?

Re: [PHP] conditional statement inside while loop?

2005-09-01 Thread Miles Thompson
At 03:52 PM 9/1/2005, z a p a n wrote: Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the

RE: [PHP] conditional statement inside while loop?

2005-09-01 Thread Murray @ PlanetThoughtful
Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do

Re: [PHP] select statement

2005-05-08 Thread Andy Pieters
On Thursday 05 May 2005 10:10, Anasta wrote: Why doesnt this work, it shows the username but not the balance of the users money.here is the mysql table: ?php session_start(); include(connect.php); $uname=$_SESSION['username']; $user_balance=mysql_query($sql); $sql = Select FROM users

Re: [PHP] select statement

2005-05-08 Thread Josip Dzolonga
On , 2005-05-08 at 23:16 +0200, Andy Pieters wrote: Notes: * just because it comes from SESSION doesn't mean that it cannot be spoofed. That's why you should escape uname before including it in a query. Is there something I do not know ? :). As far as I know, it can be spoofed only if you

Re: [PHP] select statement

2005-05-08 Thread Richard Lynch
On Sun, May 8, 2005 3:20 pm, Josip Dzolonga said: On нед, 2005-05-08 at 23:16 +0200, Andy Pieters wrote: Notes: * just because it comes from SESSION doesn't mean that it cannot be spoofed. That's why you should escape uname before including it in a query. Is there something I do not know ?

Re: [PHP] select statement

2005-05-05 Thread bala chandar
On 5/5/05, Anasta [EMAIL PROTECTED] wrote: Why doesnt this work, it shows the username but not the balance of the users money.here is the mysql table: CREATE TABLE `users` ( `user_id` int(11) NOT NULL auto_increment, `username` varchar(15) NOT NULL default '', `password` varchar(15)

Re: [PHP] select statement

2005-05-05 Thread Prathaban Mookiah
Maybe the query should be select user_balance FROM users WHERE user_id=$uname; Prathap -- Original Message --- From: Anasta [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thu, 5 May 2005 16:10:35 +0800 Subject: [PHP] select statement Why doesnt this work, it shows the

RE: [PHP] SQL statement - please help

2005-03-24 Thread Jay Blanchard
[snip] $sql = Select tblchatglobal.cgid, tblchatglobal.cgdateposted, tblchatglobal.cgtimeposted, tblchatglobal.uid, tblchatglobal.cgmsg, tblusers.uid, tblusers.uusername from tblchatglobal, tblusers where (tblchatglobal.uid = tblusers.uid) and (DATE_SUB(CURDATE(),INTERVAL 1 HOUR) =

Re: [PHP] SQL statement - please help

2005-03-24 Thread Tom Rogers
Hi, Thursday, March 24, 2005, 6:50:38 PM, you wrote: J Dear all J Please, I realy need your help. I am trying to extract only those records J that were entered during the past hour from my MySQL database. The J following SQL statement extracts all the records. As soon as I change the J

Re: [PHP] if statement probable bug

2005-03-24 Thread Richard Davey
Hello TheI2eptile, Thursday, March 24, 2005, 2:05:14 PM, you wrote: T So here is what I would call a bug, but maybe it's thought to be so: Try it with strict (data-type) comparisons, i.e.: if ($var === AS) Then you won't get the bug. Best regards, Richard Davey --

Re: [PHP] if statement probable bug

2005-03-24 Thread Jochem Maas
TheI2eptile wrote: Probably this is the wrong place to put this but I couldn't search for not at all the wrong place, having said that the only thing probable with regard to you/your post is that you are not fully aware of the nature of data types in php and the way auto-typecasting works (in

Re: [PHP] OR statement

2005-03-24 Thread Tom Rogers
Hi, Friday, March 25, 2005, 11:27:30 AM, you wrote: MD Hello, MD I would like to first thank everyone for their help with the last few MD questions I have had. I really appreciate it. MD Here is my question: MD if ($audio == Cool){ MD Do this MD }else{ MD Do that MD } MD This work fine,

Re: [PHP] OR statement

2005-03-24 Thread Josh Whiting
This work fine, however, I would like to add to the criteria above. I would like to say: if ($audio == Cool or junk or funky){ ... if (in_array($audio,array(Cool,junk,funky))) { ... } not the most elegant looking but it gets the job done. /josh w -- PHP General Mailing List

Re: [PHP] OR statement

2005-03-24 Thread Philip Olson
This work fine, however, I would like to add to the criteria above. I would like to say: if ($audio == Cool or junk or funky){ ... if (in_array($audio,array(Cool,junk,funky))) { ... } Yes that's one way but to answer the question: if ($a == 'foo' OR $a == 'bar') {

  1   2   3   >