This can also be done with double pipes, which is what is used in many
other languages.
-
if($audio==Cool || $audio==junk || $audio==Funky){
Do this
} else{
Do this
}
--
As far as I can tell there are no plans to remove or reason to
take a look here
http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html the first
example should help you...
regards
jesper
Jacques wrote:
How should I formulate my sql statement to create a result set of members
who registered between now and 7 days ago?
I have tried the following
Brad Ciszewski wrote:
is there an 'and' statement for mysql, when you are doing multiple wheres?
Is there a PHP question in your MySQL question?
--
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:
- Original Message -
From: Chris W. Parker [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 01, 2004 3:33 AM
Subject: [PHP] sql statement help needed
hello,
i've had to change some of my tables to accomodate some greater
flexibility in the application that uses it and
* Thus wrote Eric Boerner ([EMAIL PROTECTED]):
I am having a problem with a nested if statement in php. Everything
works fine, but it doesn't display the information that I am trying to
retrieve using a second if statement.
CODE:
if (($fr == 'FR') ($xe == 'XE') ($co == 'CO')) { print
[snip]
Is it possible to request that a string CONTAINS another string...?
EG:
$string = 1, 2, 3, 7, 8, 9;
if ($string CONTAINS 7) {
// Do stuff
}
[/snip]
Almost any regex function would work here, for instance
$string = 1, 2, 3, 7, 8, 9;
if (preg_match(/7/, $string)){ //evaluates to
[EMAIL PROTECTED] wrote:
Is it possible to request that a string CONTAINS another string...?
EG:
$string = 1, 2, 3, 7, 8, 9;
if ($string CONTAINS 7) {
// Do stuff
}
int strpos ( string haystack, string needle [, int offset])
is what you are looking for.
HTH,
Oliver Hankeln
--
PHP General
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 19 May 2004 12:55
Is it possible to request that a string CONTAINS another string...?
EG:
$string = 1, 2, 3, 7, 8, 9;
if ($string CONTAINS 7) {
// Do stuff
}
if (strpos($string,
Jay Blanchard wrote:
[snip]
Is it possible to request that a string CONTAINS another string...?
EG:
$string = 1, 2, 3, 7, 8, 9;
if ($string CONTAINS 7) {
// Do stuff
}
[/snip]
Almost any regex function would work here, for instance
$string = 1, 2, 3, 7, 8, 9;
if (preg_match(/7/, $string)){
[snip]
Tipp: Do not use preg_match() if you only want to check if one string
is contained in another string. Use strpos() or strstr() instead as they
will be faster.
[/snip]
This brings up a good point. Just exactly how much faster would one be
over another in this small example? How big
Jay Blanchard wrote:
[snip]
Tipp: Do not use preg_match() if you only want to check if one string
is contained in another string. Use strpos() or strstr() instead as they
will be faster.
[/snip]
This brings up a good point. Just exactly how much faster would one be
over another in this small
* Thus wrote Oliver Hankeln ([EMAIL PROTECTED]):
Jay Blanchard wrote:
[snip]
Tipp: Do not use preg_match() if you only want to check if one string
is contained in another string. Use strpos() or strstr() instead as they
will be faster.
[/snip]
This brings up a good point. Just
Curt Zirzow wrote:
* Thus wrote Oliver Hankeln ([EMAIL PROTECTED]):
10 Searches in a rather small string took
0.38s with strpos() and 0.55s with preg_match()
Make sure your benchmarks aren't bias:
- assignment takes time
- concating string takes time
You are right. I updated the script
not returning a false value...
But I'm still not getting the correct output on my page...
Any other ideas?
Oliver Hankeln [EMAIL PROTECTED]
19/05/2004 15:49
To
[EMAIL PROTECTED]
cc
Subject
Re: [PHP] IF statement question...
Curt Zirzow wrote:
* Thus wrote Oliver Hankeln ([EMAIL PROTECTED
[snip]
If I'm being Dumb, I apologies...
but When using this:
$row[bands] = 1,2,3,4,5,6,7,8;
$row2[id] = 7;
if (strpos($row[bands], $row2[id]) != FALSE) {
// do stuff
}
[/snip]
What is the expected output?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Curt Zirzow wrote:
Make sure your benchmarks aren't bias:
- assignment takes time
- concating string takes time
strpos($haystack,$needle);
v.s.
preg_match($regex,$haystack);
Just for shits and giggles (and because it's a slow work day), the below
script output this...
strpos() :
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.
Tristan, why not convert the string to an array and then use in_array()?
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 19 May 2004 15:47
If I'm being Dumb, I apologies...
but When using this:
$row[bands] = 1,2,3,4,5,6,7,8;
$row2[id] = 7;
if (strpos($row[bands], $row2[id]) != FALSE) {
// do stuff
}
I get
Jay Blanchard wrote:
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions
will work.
Personally, I prefer using preg_match() 9 times
Jay Blanchard wrote:
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.
Tristan, why not convert the string to an array and then
John Nichel wrote:
Jay Blanchard wrote:
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.
Tristan, why not convert the string to
[snip]
strpos() : 0.19018315076828
preg_match() : 0.26157474517822
in_array() : 0.26403407096863
[/snip]
Very interesting...thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
* Thus wrote Jay Blanchard ([EMAIL PROTECTED]):
[snip]
strpos() : 0.19018315076828
preg_match() : 0.26157474517822
in_array() : 0.26403407096863
[/snip]
Very interesting...thanks!
So if we're not going to search though a string 10,000 times you'll
save ~0.07139159440994 seconds. or
[snip]
for($i = 2; $i 0144; $i++){
echo $i . \n;
}
does not echo anything. Even put the numbers in quotes (single and
double). What has being brain-dead caused me to miss this morning?
[/snip]
I found it...one too many zeros in initial $i (I wanted to say one two
many..) :)
Hello Jay,
Tuesday, December 9, 2003, 1:31:35 PM, you wrote:
JB for($i = 2; $i 0144; $i++){
JB echo $i . \n;
JB }
JB does not echo anything. Even put the numbers in quotes (single and
JB double). What has being brain-dead caused me to miss this morning?
Look at your values
Steve Buehler wrote:
[snip]
$array=(/etc/bind/options.conf.wp,/etc/bind/rndc.conf.wp,/etc/bind/keys.conf.wp);
if($k2b==$array){
do this1
}else{
do this2
}
You are close. Check out in_array(). http://us4.php.net/in_array
if (in_array($kb2, $array))
- Brad
--
PHP General Mailing List
if(in_array($k2b, $array)) { ...
Steve Buehler wrote:
I have an if statement that I would like to make a little bit more
generic. This is how the statement looks now.
if($k2b==/etc/bind/options.conf.wp || $k2b==/etc/bind/rndc.conf.wp
|| $k2b==/etc/bind/keys.conf.wp){
do this1
}else{
* Thus wrote Steve Buehler ([EMAIL PROTECTED]):
What I would like to do is to have an array earlier in the script of just
the items that it is checking for so that it can be more easily changed if
I put this out as free or shareware software. Here is what it might look
like, but I know
To Brad, Marek and Curt (and anybody who responds after this)
Thank you so much for your help. This is going to help me out so
much in a lot of my scripts. It will sure make them a little.Noa
LOT more portable now.
Thanks
Steve
At 11:26 AM 9/30/2003, you wrote:
Steve Buehler
Curt Zirzow wrote:
* Thus wrote Dan J. Rychlik ([EMAIL PROTECTED]):
Well, we have a word for myself that over looks things and takes things
literal. Its called pencil smoke It means dump, dunce, and lost.
Jennifer was right, their was an error in my SQL query.
technically it was an error in
Dan J. Rychlik mailto:[EMAIL PROTECTED]
on Tuesday, September 23, 2003 4:58 PM said:
I know its failing because php doesnt like the quotation before the
format parameters. Ive tried to fix this without any luck. Any
Ideas ?
It's failing because the ' before the %d is closing the
, September 23, 2003 7:07 PM
Subject: RE: [PHP] SQL statement
Dan J. Rychlik mailto:[EMAIL PROTECTED]
on Tuesday, September 23, 2003 4:58 PM said:
I know its failing because php doesnt like the quotation before the
format parameters. Ive tried to fix this without any luck. Any
Ideas
Ive used this
$query = (SELECT username, password, DATE_FORMAT(timestamp,
'%d%m%y') FROM
custlogon);
But I recieve unknown index timestamp. *shrug*
You are receiving the error on an array returned by fetch_array? If so, it
is because the index is DATE_FORMAT(timestamp, '%d%m%y'), not
PROTECTED]; Chris W. Parker
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, September 23, 2003 7:15 PM
Subject: RE: [PHP] SQL statement
Ive used this
$query = (SELECT username, password, DATE_FORMAT(timestamp,
'%d%m%y') FROM
custlogon);
But I recieve unknown index timestamp
= SELECT username, password, DATE_FORMAT(NOW(), '%d%m%y') FROM custlogon;
-Original Message-
From: Dan J. Rychlik [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 24 September 2003 10:10
To: Chris W. Parker; [EMAIL PROTECTED]
Subject: Re: [PHP] SQL statement
Ive used this
$query
Jennifer, you're right, I am using fetch_array... I tried to use your
suggestion, and it failing as well, It wont even execute
Do you have a better method of looping through all these records??
There's probably an error in my SQL syntax. What is mysql_error() telling
you? If it was my
try this:
$query = SELECT username, password,
DATE_FORMAT(CURRENT_TIMESTAMP(), '%d%m%y') FROM custlogon;
or if that doesnt work try:
$query = SELECT username, password, DATE_FORMAT(NOW(), '%d%m%y')
FROM custlogon;
[snip]
original query as posted:
SELECT username, password,
On Tue, 23 Sep 2003 19:10:29 -0500
Dan J. Rychlik [EMAIL PROTECTED] wrote:
Ive used this
$query = (SELECT username, password, DATE_FORMAT(timestamp,
'%d%m%y') FROM custlogon);
But I recieve unknown index timestamp. *shrug*
Is timestamp an actual columnname in your table?
--
Raquel
]
Sent: Tuesday, September 23, 2003 7:25 PM
Subject: RE: [PHP] SQL statement
Jennifer, you're right, I am using fetch_array... I tried to use your
suggestion, and it failing as well, It wont even execute
Do you have a better method of looping through all these records??
There's
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, September 23, 2003 7:15 PM
Subject: RE: [PHP] SQL statement
Ive used this
$query = (SELECT username, password, DATE_FORMAT(timestamp,
'%d%m%y') FROM
custlogon);
But I recieve unknown index timestamp. *shrug*
You are receiving
Jennifer, you're right, I am using fetch_array... I tried to use your
suggestion, and it failing as well, It wont even execute
There's probably an error in my SQL syntax. What is
mysql_error() telling
you?
I dont believe it to be an error because Ive run this from the CLI
to something else and see if that helps?
-Original Message-
From: Dan J. Rychlik [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 24 September 2003 10:32
To: [EMAIL PROTECTED]; Chris W. Parker;
[EMAIL PROTECTED]
Subject: Re: [PHP] SQL statement
This didnt work as well.
SELECT username
\Apache
Group\Apache2\htdocs\Ameriforms\admintool\includes\getlogonhist.php on line
44
- Original Message -
From: Jennifer Goodie [EMAIL PROTECTED]
To: Dan J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, September 23, 2003 7:39 PM
Subject: RE: [PHP] SQL statement
Jennifer
http://www.mysql.com/doc/en/Reserved_words.html
[snip]
6.1.7 Is MySQL Picky About Reserved Words?
A common problem stems from trying to create a table with column
names that use the names of datatypes or functions built into
MySQL, such as TIMESTAMP or GROUP. You're allowed to do it (for
timestamp to something else and see if that helps?
-Original Message-
From: Dan J. Rychlik [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 24 September 2003 10:32
To: [EMAIL PROTECTED]; Chris W. Parker;
[EMAIL PROTECTED]
Subject: Re: [PHP] SQL statement
This didnt work as well
You need to change timestamp to formatted_ts in your php code.
-Original Message-
From: Dan J. Rychlik [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 23, 2003 5:45 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] SQL statement
Thank you for your time on this. I do
Thank you for your time on this.
No problem.
?php
// Function that runs reports on logon history
function logonHist() {
db_connect(); //establish connection
$_qlogonhist = (SELECT username,host_info,status, DATE_FORMAT(timestamp,
'%d%m%y')
as formatted_ts FROM
, September 23, 2003 7:50 PM
Subject: Re: [PHP] SQL statement
I tried this, and it failed. Thank you for the suggestion!
- Original Message -
From: Cody Phanekham [EMAIL PROTECTED]
To: Dan J. Rychlik [EMAIL PROTECTED];
[EMAIL PROTECTED]; Chris W. Parker [EMAIL PROTECTED];
[EMAIL
* Thus wrote Jennifer Goodie ([EMAIL PROTECTED]):
http://www.mysql.com/doc/en/Reserved_words.html
[snip]
6.1.7 Is MySQL Picky About Reserved Words?
A common problem stems from trying to create a table with column
names that use the names of datatypes or functions built into
MySQL,
* Thus wrote Dan J. Rychlik ([EMAIL PROTECTED]):
Well, we have a word for myself that over looks things and takes things
literal. Its called pencil smoke It means dump, dunce, and lost.
Jennifer was right, their was an error in my SQL query.
technically it was an error in the code not the
If you don't run PHP as an CGI but as an module, you don't even need this
line. My guess is that you run PHP as a module, so delete the line to fix
your problem.
HTH,
--
Ivo Fokkema
PHP MySQL programmer
Leiden University Medical Centre
Netherlands
Jim M Gronquist [EMAIL PROTECTED] wrote in
Ivo,
Thanks, but if I leave off this line then I get an error when I try and
view my pages.
Jim
-Original Message-
From: Ivo Fokkema [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 31, 2003 9:51 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: php path statement appears on my webpages
Thanks, but if I leave off this line then I get an error when I try and
view my pages.
What kind of error, exactly?
You need to determine if you're running PHP as a module or CGI.
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
: [PHP] Re: php path statement appears on my webpages
If you don't run PHP as an CGI but as an module, you don't even need
this
line. My guess is that you run PHP as a module, so delete the line to
fix
your problem.
HTH,
--
Ivo Fokkema
PHP MySQL programmer
Leiden University Medical Centre
DougD wrote:
I am new to all this, but here is the basic code:
$link_titles = file('links/master.txt');
$links_include = $link_titles[$point]; // path to directory
include $links_include;
If I echo the value of $links_include just prior to the include() function
it contains what I would
rtrim () solved the issue. There was a newline sitting at the end of the
variable and messing it up! Thanks for all your help!
Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
DougD wrote:
I am new to all this, but here is the basic code:
$link_titles =
Get rid of the error
Quoting shaun [EMAIL PROTECTED]:
### how do i surpress an error message for a foreach statement?
###
###
###
### --
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
###
###
--
Richard Whitney *
Transcend
You don't.
From http://www.php.net/manual/en/control-structures.foreach.php
Note: foreach does not support the ability to suppress error messages using
'@'.
You should check the validity of your argument before passing it to foreach
if(is_array($array)){
foreach($array as $key=$val){
]
To: shaun [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 3:34 PM
Subject: RE: [PHP] foreach statement
You don't.
From http://www.php.net/manual/en/control-structures.foreach.php
Note: foreach does not support the ability to suppress error messages
using
'@'.
You should
Comparing a float with an integer can have problems. You could try something
like:
if(abs($i - $target) .1) {
//then they are essentially equal
}
Kirk
-Original Message-
From: James E Hicks III [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 11:22 AM
To: [EMAIL
At 19:21 14.03.2003, James E Hicks III said:
[snip]
Help save my sanity! What can I do to the IF statement in the following
code to
make it print the line that says By God they are equal in value.? I have
tried
the following changes;
1. using ===
What happens if you change $target to 216.0?
-- jon
-Original Message-
From: James E Hicks III [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 1:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] IF statement madness
Help save my sanity! What can I do to the IF statement in the
-Original Message-
From: James E Hicks III [mailto:[EMAIL PROTECTED]
Sent: 14 March 2003 18:22
Help save my sanity! What can I do to the IF statement in the
following code to
make it print the line that says By God they are equal in
value.? I have tried
the following changes;
Thank you (all who resonded)!!! It makes sense now.
Now I can wait until 5:00pm, quitting time, to go crazy!!
James
-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 1:23 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] IF statement madness
I've been using this:
if (in_array($value, array(foo, bar, blah)))
{
// do something
}
but if you want to use a switch/case, I don't know any easier way.
HTH
Martin
-Original Message-
From: CF High [mailto:[EMAIL PROTECTED]
Sent: Monday, March 03, 2003 1:41 PM
To: [EMAIL
Check the manual:
switch($foo)
{
case fee:
case fie:
...
break;
case fo:
...
case fum:
...
break;
}
fee fie are tied together, fie will also run the code presented by fum ...
Even
switch($value){
case 'foo':
case 'bar':
//It's either foo or bar
break;
}
CF High wrote:
Hey all.
In Cold Fusion I was able to do the following:
CFSWITCH expression = #action#
CFCASE value = getUpdate,getDelete
Do Stuff
/CFCASE
/CFSWITCH
Note the comma
Duh. make that
fo will also run the code presented by fum ...
-Original Message-
From: Mark Charette [mailto:[EMAIL PROTECTED]
switch($foo)
{
case fee:
case fie:
...
break;
case fo:
...
case fum:
I've got a simple switch statement that carries out one of several
operations based on the switch statement variable value.
Each operation has @ 50 lines of html -- do I have to echo or print
all
this
html!?
You could put your HTML into a separate file and just include() it
wherever you
On Saturday 25 January 2003 20:38, CF High wrote:
Each operation has @ 50 lines of html -- do I have to echo or print all
this html!?
Try something like
?php
switch ($foo) {
case 1:
?
h1Hello/h1
?php
break;
}
?
johannes
--
PHP General Mailing List (http://www.php.net/)
To
No. You can either echo/print with a heredoc (which is still
echoing/printing, but is a lot easier) or you can exit PHP. For example:
?php
switch($somevar){
case 'case1':
print END
some html
some html
some html
END;
break;
case 'case2':
print END
some html
some html
some html
END;
break;
}
?
PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, January 25, 2003 8:38 AM
Subject: Re: [PHP] Switch statement || How to output html without using
echo() or print()
On Saturday 25 January 2003 20:38, CF High wrote:
Each operation has @ 50 lines of html -- do I have to echo or print all
: John W. Holmes [EMAIL PROTECTED]
To: 'CF High' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, January 25, 2003 8:42 AM
Subject: RE: [PHP] Switch statement || How to output html without using
echo() or print()
I've got a simple switch statement that carries out one of several
operations
Thanks for the informative response, Leif.
Looks like you and Johannes are on the same page -- these solutions save a
great deal of time.
Thanks,
--Noah
Leif K-Brooks [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
No. You can either echo/print with a heredoc
On Thu, 19 Dec 2002, Max Clark wrote:
I was wondering if php had a case function?
Instead of building a large if/elseif/else block I would like to do a
case $page in (list).
switch function ...
http://www.php.net/manual/en/control-structures.switch.php
~Chris
--
PHP General
-Original Message-
From: Max Clark [mailto:[EMAIL PROTECTED]]
Sent: 19 December 2002 18:19
I was wondering if php had a case function?
Instead of building a large if/elseif/else block I would like
to do a case
$page in (list).
http://www.php.net/control-structures.switch
Yes, It's called SWITCH
Just go to www.php.net and lookup switch in the function list
Max Clark [EMAIL PROTECTED] wrote:Hi-
I was wondering if php had a case function?
Instead of building a large if/elseif/else block I would like to do a case
$page in (list).
Thanks in advance,
Max
--
On Thu, 19 Dec 2002, Max Clark wrote:
Hi-
I was wondering if php had a case function?
Instead of building a large if/elseif/else block I would like to do a case
$page in (list).
The documentation and search capabilities at http://www.php.net are your
frientd. It would behhove you to at
At 13:50 26.11.2002, [EMAIL PROTECTED] said:
[snip]
I'll be trying to use a routine that checks 4 seperate variables for
content and need to know the easiest method to do so. The function works
on 2 conditions; either all the variables are empty and I do
All four must be an empty string. I will be pulling the values from a
MySQL database. If these fields are empty I'll be prompting for
information. If any one of them contain anything I'll be showing it to
the user and asking if they want to change it.
Thanks,
Ed
On Tue, 26 Nov 2002, Ernest E
Ed,
Assuming there will be a response from the db-tbl, here is another choice:
if ( $lineone . $linetwo . $linethree . $linefour )
{
//show it to the user and ask if they want to change it
}
else
{
//prompt for information
}
Do you mean that the db-tbl will have a row of data even if the
The db will include these 4 rows even though they don't store data.
Eventually they will contain data for contact info as soon as the users
log in and it prompts them for it.
On Tue, 26 Nov 2002, DL Neil wrote:
Ed,
Assuming there will be a response from the db-tbl, here is another choice:
Something like this will work...
?php
if(empty($_GET['1']) empty($_GET['2']) empty($_GET['3'])
empty($_GET['4'])){
echo All vars are EMPTY;
}else{
echo Some vars contain Content;
}
?
[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
The db will
--- Ernest E Vogelsinger [EMAIL PROTECTED] wrote:
At 13:50 26.11.2002, [EMAIL PROTECTED] said:
if ($lineone $linetwo $linethree $linefour = )
Your expression yields true if 1-3 are not-empty AND four is an
empty string.
Actually, this expression yields true when $lineone, $linetwo, and
On Tuesday 26 November 2002 23:45, Chris Shiflett wrote:
--- Ernest E Vogelsinger [EMAIL PROTECTED] wrote:
At 13:50 26.11.2002, [EMAIL PROTECTED] said:
if ($lineone $linetwo $linethree $linefour = )
Your expression yields true if 1-3 are not-empty AND four is an
empty string.
--- Jason Wong [EMAIL PROTECTED] wrote:
At 13:50 26.11.2002, [EMAIL PROTECTED] said:
if ($lineone $linetwo $linethree $linefour = )
Actually that expression will always be FALSE. $linefour =
does not evaluate to TRUE thus the whole expression to be FALSE!
Yes, you're right. Of course, I
At 16:45 26.11.2002, Chris Shiflett spoke out and said:
[snip]
--- Ernest E Vogelsinger [EMAIL PROTECTED] wrote:
At 13:50 26.11.2002, [EMAIL PROTECTED] said:
if ($lineone $linetwo $linethree $linefour = )
Your expression yields true if 1-3 are
--- Ernest E Vogelsinger [EMAIL PROTECTED] wrote:
if ($lineone $linetwo $linethree $linefour = )
Your expression yields true if 1-3 are not-empty AND four is an
empty string.
Actually, this expression yields true when $lineone, $linetwo,
and
$linethree are all true. The variable
Hi,
Tuesday, October 1, 2002, 5:11:08 PM, you wrote:
PO $title_err = ($adTitle == ) ? 1 : strlen($adTitle) 50 ? 2 : 0;
PO Can anyone tell me why this is not evaluating correctly (returning a
PO value of 1) when $adTitle is an empty string?
It is right according to your expression, try
Pablo Oliva wrote:
$title_err = ($adTitle == ) ? 1 : strlen($adTitle) 50 ? 2 : 0;
Can anyone tell me why this is not evaluating correctly (returning a
value of 1) when $adTitle is an empty string?
I have no idea... but if you change your code to this, it works:
$title_err = ($adTitle ==
René Moonen wrote:
Pablo Oliva wrote:
$title_err = ($adTitle == ) ? 1 : strlen($adTitle) 50 ? 2 : 0;
Can anyone tell me why this is not evaluating correctly (returning a
value of 1) when $adTitle is an empty string?
I have no idea... but if you change your code to this, it works:
-Original Message-
From: Pablo Oliva [mailto:[EMAIL PROTECTED]]
Sent: 01 October 2002 08:11
To: [EMAIL PROTECTED]
Subject: [PHP] conditional statement problems
$title_err = ($adTitle == ) ? 1 : strlen($adTitle) 50 ? 2 : 0;
Can anyone tell me why this is not evaluating
U must write:
mysql_query(INSERT INTO cast SET Rick='$Rick', Blaine='$Blaine',
Humphrey='$Humphrey', Bogart='$Bogart', male='$male');
The stuff with the $ before them are variable that contain the info u
want to put into the word that don't have the $ those words are the
cells in your database.
[snip]
Say i have a variable $string_var = Once upon a time;
is there a way to do this:
Switch($string_var)
{
case(contains Once):
doSomething();
break;
case(contains the end.)
doOtherThing();
break;
case(contains time)
doNothing();
break;
default:
echo ERROR
}
Alternatively Alexander,
take a look at the string functions eg strstr(), stristr(), and strpos() all
of which can be used to make a condition within the case() criteria.
Regards,
=dn
[snip]
Say i have a variable $string_var = Once upon a time;
is there a way to do this:
[snip]
I know that i can retrieve records 1-24 in my db with a select statement
like SELECT whatever FROM tablename ORDER BY id ASC LIMIT 23, but how can I
get records 25 to 50 if I have 100 records in my DB?
[/snip]
Different DB's have differing ways of doing this, like MySQL;
SELECT *
FROM
You can do this:
if ($type == test1 || $type == test2 || $type == test3) {
or, what I prefer in this case
if (in_array($type, array(test1, test2, test3))) {
Martin
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 09, 2002 2:11 PM
To:
this is the problem:
$query = Select OSUSER
From v$session
Where USERNAME = (Select USER From DUAL)
And AUDSID =(Select USERENV('SESSIONID') From DUAL);
1.
mysql does NOT support subselects!
2.
delete the in front of FROM
3.
you have to quote v$session: v\$session
start with a short query
('SESSIONID') From DUAL);
great thanks in advance to michi...
^_^
- Original Message -
From: èdy kurniawan [EMAIL PROTECTED]
Subject: Re: [PHP] SQL Statement
thanks to michi for ASAP response...
but I thought your opinion not actually right..
I've a sql :
$query = Select dfl_desc
I've tried a hundred different things -- YOURS WORKED! Thank you very much!
-Doug
- Original Message -
From: Niklas Lampén [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: Monday, June 17, 2002 10:45 PM
Subject: RE: [PHP] include statement errors -- something missing
So far
101 - 200 of 271 matches
Mail list logo