473,388 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Using equality in 'for' loop - why not?

A 'for' loop takes 3 arguments (initialize; test; increment). The 'test'
must equate as true or false

This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}
...nor does...
x = 5;
for (y=1; (y===5); y+=1) {
alert(x * y);
}
....but this does..
x = 5;
for (y=1; (y<6); y+=1) {
alert(x * y);
}

Why do the first two fail? If i is value 5 then i==5 is true, as is
i===5.

Can anyone explain what I'm missing here?

Regards


Jul 23 '05 #1
23 2166
In article <c9*******************@news.demon.co.uk>, Mark Anderson
says...
A 'for' loop takes 3 arguments (initialize; test; increment). The 'test'
must equate as true or false

This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}
This fails because after the first loop "y" becomes 12. Try
for (y=1; y!=5; y++)

Why do the first two fail? If i is value 5 then i==5 is true, as is
i===5.
The loop executes while the condition is true. In your example you
assign 1 to y, so the condition y==5 is false.

Can anyone explain what I'm missing here?


You're missing the documentation:
http://tinyurl.com/jbie

--
Hywel I do not eat quiche
http://kibo.org.uk/
http://kibo.org.uk/mfaq.php
Jul 23 '05 #2
Mark Anderson wrote:

Hi Mark
A 'for' loop takes 3 arguments (initialize; test; increment). The 'test'
must equate as true or false

This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}
yes, I think it works.
Just not as expected.
Your 'test' fails the first time because y=1 and not 5.

Think of for-loop as follows, maybe that helps:

for (initialize; test; increment){
statements;
}

is equal to:

initialize;
while(test) {
statements;
increment;
}
Now you can explain the rest too. :-)
..nor does...
x = 5;
for (y=1; (y===5); y+=1) {
alert(x * y);
}
...but this does..
x = 5;
for (y=1; (y<6); y+=1) {
alert(x * y);
}

Why do the first two fail? If i is value 5 then i==5 is true, as is
i===5.

Can anyone explain what I'm missing here?

Regards

Regards,
Erwin Moller
Jul 23 '05 #3
Lee
Mark Anderson said:

A 'for' loop takes 3 arguments (initialize; test; increment). The 'test'
must equate as true or false

This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}
..nor does...
x = 5;
for (y=1; (y===5); y+=1) {
alert(x * y);
}
...but this does..
x = 5;
for (y=1; (y<6); y+=1) {
alert(x * y);
}

Why do the first two fail? If i is value 5 then i==5 is true, as is
i===5.

Can anyone explain what I'm missing here?


You're setting x=5 and y=1 and seem to be surprised that y!=5.
Without knowing you, it's hard to guess whether this is oversight
or if you really are missing something.

Jul 23 '05 #4

"Hywel" <hy**********@hotmail.com> wrote in message
news:MP************************@news.individual.ne t...
In article <c9*******************@news.demon.co.uk>, Mark Anderson
says...
A 'for' loop takes 3 arguments (initialize; test; increment). The 'test'
must equate as true or false

This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}


This fails because after the first loop "y" becomes 12.


Why is the first iteration performed and how does 'y' become 12?

--
S.C.
Jul 23 '05 #5
Stephen Chalmers wrote:

Why is the first iteration performed and how does 'y' become 12?
x = 5;
for (y=1; y==5; y+=1) {
alert(x * y);
} S.C.

It doesn't.
The loop never starts, since y doesn't equal 5.

Mick

Jul 23 '05 #6
Lee

"Lee" <RE**************@cox.net> wrote in message
news:c9*********@drn.newsguy.com...
Mark Anderson said:

A 'for' loop takes 3 arguments (initialize; test; increment). The 'test'must equate as true or false

This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}
..nor does...
x = 5;
for (y=1; (y===5); y+=1) {
alert(x * y);
}
...but this does..
x = 5;
for (y=1; (y<6); y+=1) {
alert(x * y);
}

Why do the first two fail? If i is value 5 then i==5 is true, as is
i===5.

Can anyone explain what I'm missing here?

Without knowing you, it's hard to guess whether this is oversight
or if you really are missing something.
You're setting x=5 and y=1 and seem to be surprised that y!=5.


And so I should be! I'm saying "start with y=1 ad while y is not 5
(ergo less than or equal to 5) do the loop and increment by five.

Your explanation is implying I'm testing in loop #1...

x = 5;
for (y=5; (y===5); etc...

I feel oppressed by all the right-brain thinking here.

Why didn't the blokes (perhaps ladies?) who wrote the spec just say
explicitly don't use ==/!=/===/!== in for loop test if they don't work.
I've looked at the NS docs - and there's no indication that these aren't
allowed.

Please folks I'm not an engineer or a logic PhD. Could posters please
*explain* their put-downs rather than just say you're wrong. I asked the
question both because I don't understand and I wish to understand why.
So far all that I've read is "I'm cleverer than you" answers telling me
I'm wrong. I know! Just please explain why...

Regards

Mark
Jul 23 '05 #7
Mark Anderson wrote:
And so I should be! I'm saying "start with y=1 ad while y is not 5
(ergo less than or equal to 5) do the loop and increment by five.
You set y to 1 and then loop while y is equal to 5. Since y is not equal
to 5 before the first iteration, the loop body is never executed.
Why didn't the blokes (perhaps ladies?) who wrote the spec just say
explicitly don't use ==/!=/===/!== in for loop test if they don't work.
I've looked at the NS docs - and there's no indication that these aren't
allowed.


They are allowed, and there are cases where they make sense, for example

for (counter = 0; stillrunning == 1; counter++) {
if (something) stillrunning = 0;
}

The condition can be more complex, too -- in any case the way the loop
is processed is such that the condition is checked *before* executing
the loop, so if your condition is not true to start with, the loop is
executed zero times.

Hope that helps

--
Klaus Johannes Rusch
Kl********@atmedia.net
http://www.atmedia.net/KlausRusch/
Jul 23 '05 #8
Mark Anderson wrote on 28 mei 2004 in comp.lang.javascript:
This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}
Yes it works

start with y=1
then do something WHILE y==5

WHICH boolean is not true from the start,
so no alert output !!!
..nor does...
x = 5;
for (y=1; (y===5); y+=1) {
alert(x * y);
}
Yes it works

start with y=1
then do something WHILE y===5

WHICH boolean is NOT true from the start,
so no alert output !!!
...but this does..
x = 5;
for (y=1; (y<6); y+=1) {
alert(x * y);
}


Yes it surely works

start with y=1
then do something WHILE y<6

WHICH boolean is true when y=1, 2, 3, 4, 5

So 5 times an alert output

====================

btw:
1 the () around y<6 are not needed
2 y+=1 is the same as y++
3 alerts in a loop can drive you crazy
4 using var can sometimes save you trouble when in a function,
because it leaves global values alone

Commonly this is used:

var x = 5;
for (var y=1; y<6; y++) {
document.write( x*y + "<br>");
}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #9
Klaus Johannes Rusch wrote on 28 mei 2004 in comp.lang.javascript:
They are allowed, and there are cases where they make sense, for example

for (counter = 0; stillrunning == 1; counter++) {
if (something) stillrunning = 0;
}


No, no sense, but this does:

var stillrunning = 17
for (counter = 0; stillrunning == 1; counter++) {
if (counter==2300 or somethingelse) stillrunning = 1;
}

though I would prefer:

var stillrunning = true
for (counter = 0; stillrunning ; counter++) {
if (counter==2301 or somethingelse) stillrunning = false;
}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #10
Stephen,

"Stephen Chalmers" <me@here.com> wrote in message
news:40********@mk-nntp-2.news.uk.tiscali.com...

"Hywel" <hy**********@hotmail.com> wrote in message
news:MP************************@news.individual.ne t...
In article <c9*******************@news.demon.co.uk>, Mark Anderson
says...
A 'for' loop takes 3 arguments (initialize; test; increment). The 'test' must equate as true or false

This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}


This fails because after the first loop "y" becomes 12.


Why is the first iteration performed and how does 'y' become 12?

--
S.C.


Wait a minute, a 'for' loop excutes *until* test it true. Ergo, on
iteration #1, i=1 and test is 'false' and lop #1 executes - except it
doesn't. Can you please prove y=12 rather than state such a provactive
aasertion without explanation. I posted here to learn not be told I'm
too dumb to understand.

I don't mind rules as long as they can be understood. It seems the logic
on the for loop rests on some abstruse logic that - self-evidently -
isn't obvious.

Even so I'm a pragmatist and I'll go with the flow but it's a shame no
JS book or online tutorial I can find says not to use == or === (or
their negative equivalents) in a for loop as the test.

Regards

Mark
Jul 23 '05 #11
Evertjan,

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Mark Anderson wrote on 28 mei 2004 in comp.lang.javascript:
This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}


Yes it works

start with y=1
then do something WHILE y==5

WHICH boolean is not true from the start,
so no alert output !!!
..nor does...
x = 5;
for (y=1; (y===5); y+=1) {
alert(x * y);
}


Yes it works

start with y=1
then do something WHILE y===5

WHICH boolean is NOT true from the start,
so no alert output !!!
...but this does..
x = 5;
for (y=1; (y<6); y+=1) {
alert(x * y);
}


Yes it surely works

start with y=1
then do something WHILE y<6

WHICH boolean is true when y=1, 2, 3, 4, 5

So 5 times an alert output

====================

btw:
1 the () around y<6 are not needed
2 y+=1 is the same as y++
3 alerts in a loop can drive you crazy
4 using var can sometimes save you trouble when in a function,
because it leaves global values alone

Commonly this is used:

var x = 5;
for (var y=1; y<6; y++) {
document.write( x*y + "<br>");
}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


And the prize goes to EvertJan. Now it is explained I understand.
Shame no books tutorials stoop so low as to explain this simple fact.

I now know why I won't use ++ etc., except in the exceptional cases such
as Klaus just described.

Thanks. My faith in Usenet is restored!

Regards

Mark
Jul 23 '05 #12
Lee
Mark Anderson said:

Lee

"Lee" <RE**************@cox.net> wrote in message
news:c9*********@drn.newsguy.com...
Mark Anderson said:
>
>A 'for' loop takes 3 arguments (initialize; test; increment). The'test' >must equate as true or false
>
>This doesn't work...
>x = 5;
>for (y=1; (y==5); y+=1) {
> alert(x * y);
>}
>..nor does...
>x = 5;
>for (y=1; (y===5); y+=1) {
> alert(x * y);
>}
>...but this does..
>x = 5;
>for (y=1; (y<6); y+=1) {
> alert(x * y);
>}
>
>Why do the first two fail? If i is value 5 then i==5 is true, as is
>i===5.
>
>Can anyone explain what I'm missing here?

Without knowing you, it's hard to guess whether this is oversight
or if you really are missing something.

You're setting x=5 and y=1 and seem to be surprised that y!=5.


And so I should be! I'm saying "start with y=1 ad while y is not 5
(ergo less than or equal to 5) do the loop and increment by five.


No, you've got the sense of the test wrong, and possibly
misunderstand the increment (did you mean to say "increment by one"?).

You're saying "start with y=1 and while y *is* 5 do the loop
and increment by 1".

The loop is performed *while* the condition is true,
not *until* it is true.

If you want to start with y=1 and increment by 1 while y is
not 5, you should use:

for (y=1; y<5; y++)

Jul 23 '05 #13
In article <40********@mk-nntp-2.news.uk.tiscali.com>, Stephen Chalmers
says...

"Hywel" <hy**********@hotmail.com> wrote in message
news:MP************************@news.individual.ne t...
In article <c9*******************@news.demon.co.uk>, Mark Anderson
says...
A 'for' loop takes 3 arguments (initialize; test; increment). The 'test'
must equate as true or false

This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}


This fails because after the first loop "y" becomes 12.


Why is the first iteration performed and how does 'y' become 12?


My mistake - I used document.write(y) in a simpler test but forgot to
use something to separate the values.

Mark - the reason your code is wrong is simple: you're testing to see it
y is equal to 5. You're trying you get a loop to work while y is 5. As
you start your loop with y=1, it is never 5. How many people have told
you that?

If you read the JavaScript documentation at
http://developer.netscape.com/ you'll see that the syntax of a for loop
is quite simple:

for ([initial-expression]; [condition]; [increment-expression]) {
statements
}

The fact that the tutorials you're used do not explicitly tell you not
to use == or === is simple: the test will never evaluate in the manner
that you need for your code to continue. The logic is quite clear. For
example, this code
for (x=0; x<5; x++)
says assign the value zero to x. While x is less than 5 increment it.
When x is equal to 5, stop.

Your code
for (y=1; (y==5); y+=1)
says assign the value one to y. While y is equal to 5, increment it.
When, and how, will y ever become 5 in your code?

I appreciate that there is a learning process involved and that it may
not be always clear, but I'm sure you'll find it becomes more obvious
the more you use JavaScript.

--
Hywel I do not eat quiche
http://kibo.org.uk/
http://kibo.org.uk/mfaq.php
Jul 23 '05 #14
Mark Anderson wrote:
"Stephen Chalmers" <me@here.com> wrote in message
news:40********@mk-nntp-2.news.uk.tiscali.com...
Please do not write attribution novels, see
<http://netmeister.org/news/learn2quote.html>
"Hywel" [...] wrote [...]
> [...] Mark Anderson [...] says...
> > This doesn't work...
> > x = 5;
> > for (y=1; (y==5); y+=1) {
> > alert(x * y);
> > }
>
> This fails because after the first loop "y" becomes 12.


Why is the first iteration performed and how does 'y' become 12?
[...]


Wait a minute, a 'for' loop excutes *until* test it true. [...]


If you think of `test' as in

for (init; test; loop_stmt)
{
...
}

that is wrong. A "for" loop executes *as long as* `test'
evaluates to `true'. Such a loop is head-controlled,
terminated and thus equivalent to

init;
while (test)
{
...
loop_stmt;
}

That is not equivalent to

init;
do
{
...
loop_stmt;
}
while (test)

as you apparently think.
Ergo, on iteration #1, i=1 and test is 'false' and lop #1 executes


No, it does not, unless `test' is true, i.e. "y" evaluates to 5. If we
assume that this is only a snippet, it may execute as previous statements
may have assigned 5 to y. If we assume that this is the whole code, it
never executes, since no value has been assigned to "y" and thus its
value is `undefined' which is even with type casting not equal to 5.
PointedEars
Jul 23 '05 #15
Thanks to everyone - really! I just wish FAQs etc. Made this clear.
Running several FAQs myself I know how things I see as 'obvious' aren't
to a newbie and there's oftenno way to guess your way to expertise.

Request for addition to the n/g's FAQ? In that vein I'd also request I'd
also suggest a note to explain the safe version of var i++. Users of the
wonderful JS Lint are told it is dangerous to use. Why, is less clear;
put your JS smarts aside and try to find an explanation online - that a
newbie understands - and more importantly, a description of what you use
instead (I believe it is i+=1 ).

Thanks again to everyone for haring, now I truly understand why the
books are so cra*p and what I was doing wrong after reading them.

Regards

Mark
Jul 23 '05 #16
Mark Anderson wrote:
Thanks to everyone - really! I just wish FAQs etc. Made this clear.
Running several FAQs myself I know how things I see as 'obvious' aren't
to a newbie and there's oftenno way to guess your way to expertise.

Request for addition to the n/g's FAQ?


Please don't, that is well-documented behavior. RTFM, i.e. see the
ECMAScript (3) Specification, the Netscape Core JavaScript Reference(s)
and the MSDN Library. `for' is not different in ECMAScript and its
implementations from any other language of the C family. It is one
of the first things people should learn when they learn how to code,
not when they learn how to code J(ava)Script.
PointedEars
Jul 23 '05 #17
Mark Anderson wrote:
"Stephen Chalmers" <me@here.com> wrote in message
news:40********@mk-nntp-2.news.uk.tiscali.com...
Please do not write attribution novels, see
<http://netmeister.org/news/learn2quote.html>
"Hywel" [...] wrote [...]
[...] Mark Anderson [...] says...
This doesn't work...
x = 5;
for (y=1; (y==5); y+=1) {
alert(x * y);
}

This fails because after the first loop "y" becomes 12.


Why is the first iteration performed and how does 'y' become 12?
[...]


Wait a minute, a 'for' loop excutes *until* test it true. [...]


If you think of `test' as in

for (init; test; loop_stmt)
{
...
}

that is wrong. A "for" loop executes *as long as* `test'
evaluates to `true'. Such a loop is head-controlled,
terminated and thus equivalent to

init;
while (test)
{
...
loop_stmt;
}

That is not equivalent to

init;
do
{
...
loop_stmt;
}
while (test)

as you apparently think.
Ergo, on iteration #1, i=1 and test is 'false' and lop #1 executes


No, it does not, unless `test' is true, i.e. "y" evaluates to 5. Since 1
has been assigned to "y" previously in the initialization part, it does not
evaluate to 5, so the loop is never executed.
PointedEars
Jul 23 '05 #18
Mark Anderson wrote:


Why didn't the blokes (perhaps ladies?) who wrote the spec just say
explicitly don't use ==/!=/===/!== in for loop test if they don't work.
I've looked at the NS docs - and there's no indication that these aren't
allowed.

There are situations when you can use "== !="

y=5
for(i=0;y==5;i++){
alert(y);
if(i==2){y=4;}
}
alert(y)

Mick

Mark

Jul 23 '05 #19

"Thomas 'PointedEars' Lahn" <Po*********@nurfuerspam.de> wrote in message
news:40**************@PointedEars.de...
`for' is not different in ECMAScript and its
implementations from any other language of the C family.


Hmmm. In ECMAScript, the scope of variables declared in the initialisation
statement, is not the same as it is in C++.

--
S.C.
Jul 23 '05 #20
Stephen Chalmers wrote:
"Thomas 'PointedEars' Lahn" <Po*********@nurfuerspam.de> wrote in message
news:40**************@PointedEars.de...


Please do not write attribution novels, see
<http://netmeister.org/news/learn2quote.html>
`for' is not different in ECMAScript and its
implementations from any other language of the C family.


Hmmm. In ECMAScript, the scope of variables declared in the initialisation
statement, is not the same as it is in C++.


ACK. I was referring to the test expression, this is a C-style `for'.
PointedEars
Jul 23 '05 #21
JRS: In article <c9*******************@news.demon.co.uk>, seen in
news:comp.lang.javascript, Mark Anderson <ma**@notmeyeardley.demon.co.uk
posted at Fri, 28 May 2004 16:45:50 : A 'for' loop takes 3 arguments (initialize; test; increment). The 'test'
must equate as true or false


ISTM that this is not a matter for the FAQ, but that it is a matter for
tutorials.

In different languages, loops are expressed in many different ways; but
ISTM that in the relevant respect there are exactly two different
classes.

For any loop, there is an initialisation, there is a change-between-
loops, and there is a condition. The condition is always equivalent to
a Boolean - that is inevitable, though Booleanisation may be implicit.

One class of loop has a termination condition; false to run.
One class of loop has a continuation condition; true to run.

The first class is exemplified by
Algol's for J := 3 step 6 until 9 // J=9
Pascal's for J := 8 down to 4 // J=4
repeat Inc(J) ; ... until J=9
(the first two could be interpreted with <=, and are probably
implemented that way; but the mind is likely to consider the condition
as "finish after J equals given value");
and the second by
Javascript's for (J=3 ; J<=9 ; J+=6)
Pascal's while J<9 do begin Inc(J) ; ... end ;

In the second, the Boolean is usually, but not always, an ordered
comparison - > >= < <=, explicit or implicit. However :
for (J=new Date();J.getMonth()==4;J=new Date()) {}
for (J=new Date();J.getMonth()!=5;J=new Date()) {}
should, ISTM, each loop until June.
The OP has been giving a termination condition where a continuation
condition is required.
There is another dichotomy, that of whether the finalisation condition
is evaluated before or after the loop body
while (new Date()<1234567890000) {}
do {} while (new Date()<1234567890000)
each of which should loop until 2009-02-13 Fri 23:31:30 GMT. IIRC, a
FORTRAN IV loop tested at the end, so the loop was always executed once;
but an Algol 60 loop tested at the beginning.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #22
"Mark Anderson" <ma**@notmeyeardley.demon.co.uk> writes:
Shame no books tutorials stoop so low as to explain this simple fact.
What about:
<URL:http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/stmt.html#1004804>
<URL:http://msdn.microsoft.com/library/en-us/script56/html/js56jsstmfor.asp?frame=false>
I now know why I won't use ++ etc., except in the exceptional cases such
as Klaus just described.


I always use ++, and can see no problem with that. It's just the comparison
that should usually not be an "equals-to" test.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #23
rh
Lasse Reichstein Nielsen wrote:
"Mark Anderson" <ma**@notmeyeardley.demon.co.uk> writes:
Shame no books tutorials stoop so low as to explain this simple fact.


What about:
<URL:http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/stmt.html#1004804>
<URL:http://msdn.microsoft.com/library/en-us/script56/html/js56jsstmfor.asp?frame=false>


Both references appear to be satisfactory for the description of the
for "condition".

However, the latter reference describes the "initialization",
"condition", and "increment" as being required. The former describes
the "condition" as optional, with the potential mistaken implication
that the other two are required.

In fact, the form

for (;;); // Infinite loop, by the way

is compliant with ECMA-262/3. Later browsers (don't know about earlier
ones) accept the above form, including MS IE 6, so it appears it may
be just the documentation that is not entirely "with the program". :)

../rh
Jul 23 '05 #24

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: gi75research | last post by:
What should be a very simple function is going terribly wrong, and I don't know why. StartTime and EndTime are table values (formatted like "01:00A" or "02:00P"); DaypartStart and DaypartEnd are...
40
by: Ike Naar | last post by:
In K&R "The C++ programming language (2nd ANSI C edition), the reference manual states (paragraphs 7.9 and 7.10) that pointer comparison is undefined for pointers that do not point to the same...
14
by: Clint Olsen | last post by:
I was wondering if it's considered undefined behavior to use a member of a union when it wasn't initialized with that member. Example: typedef unsigned long hval_t; hval_t hval_init(void) {...
19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
4
by: Matt Burland | last post by:
I'm a little confused about the way the default equality operator works with classes. Here's the situation, I have two comboboxes that are each filled with different object (i.e. ComboBox1 contains...
21
by: Geoff Cox | last post by:
Hello I have a TINYINT(1) field, group1, in a mysql data base and the value is 1 but php if ($row == "1") { does not work. What should I be writing here?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.