Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,906 members, 7,802,943 topics. Date: Saturday, 20 April 2024 at 04:38 AM

Help...my If Statement In Php Is Not Echoing - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help...my If Statement In Php Is Not Echoing (1306 Views)

This Php Is About To Make Me Go Nuts. Pls Help / Javascript - If Statement / Web Developer Needed Urgently. Knowledge Of Php Is An Added Advantage (2) (3) (4)

(1) (Reply) (Go Down)

Help...my If Statement In Php Is Not Echoing by cr80vity(m): 10:18am On Jan 15, 2016
pls help, I dnt understand wats wrong...ds s d code:

if ($query_num_rows==0) {
echo "invalid username/password";
} else {
echo "ok.";
}

pls s dere any reason why it's nt echoing
Re: Help...my If Statement In Php Is Not Echoing by maekhel(m): 10:32am On Jan 15, 2016
The code you provide is not complete/not enough to help you.
Let's see the query gan gan grin
Re: Help...my If Statement In Php Is Not Echoing by Nobody: 11:25am On Jan 15, 2016
Try this and let us know if it works:

Put the following code at the beginning of your script before you connect to database (if your database connection script is in another file, put this code at the beginning of that file only)
display_errors(true);
ini_set('display_errors', 'On');
Re: Help...my If Statement In Php Is Not Echoing by DonSegmond(m): 4:16pm On Jan 15, 2016
cr80vity:
pls help, I dnt understand wats wrong...ds s d code:

if ($query_num_rows==0) {
echo "invalid username/password";
} else {
echo "ok.";
}

pls s dere any reason why it's nt echoing
how are you running your program? through the browser or on command line?
Re: Help...my If Statement In Php Is Not Echoing by Nobody: 4:49pm On Jan 15, 2016
DonSegmond:

how are you running your program? through the browser or on command line?
file:///c:/xamp/htdocs/echobot.php or something
Re: Help...my If Statement In Php Is Not Echoing by nnamdiosu(m): 5:21pm On Jan 15, 2016
cr80vity:
pls help, I dnt understand wats wrong...ds s d code:

if ($query_num_rows==0) {
echo "invalid username/password";
} else {
echo "ok.";
}

pls s dere any reason why it's nt echoing

see....instead of == 0, try > 0 . that is greater than zero. also post the complete code. all I can do is guess work for now
Re: Help...my If Statement In Php Is Not Echoing by Easyjay: 7:39pm On Jan 15, 2016
when you run your code, what error is it outputting? You try get the error first
Re: Help...my If Statement In Php Is Not Echoing by seunoni34(m): 1:25pm On Jan 17, 2016
cr80vity:
pls help, I dnt understand wats wrong...ds s d code:

if ($query_num_rows==0) {
echo "invalid username/password";
} else {
echo "ok.";
}

pls s dere any reason why it's nt echoing
Try this instead

if ($query_num_rows < 1)
{
echo 'invalid username/password' ;
}
else
{
echo 'ok.' ;
}
Re: Help...my If Statement In Php Is Not Echoing by BekBek(m): 1:59pm On Jan 17, 2016
cr80vity:
pls help, I dnt understand wats wrong...ds s d code:

if ($query_num_rows==0) {
echo "invalid username/password";
} else {
echo "ok.";
}

pls s dere any reason why it's nt echoing


Did you get any error and what isthe error code
Re: Help...my If Statement In Php Is Not Echoing by daddynasa: 9:41am On Jan 21, 2016
Run ur code thru localhost turn on ur server ur if statement is correct.
Re: Help...my If Statement In Php Is Not Echoing by CRAZYMADMAN(m): 10:52am On Jan 21, 2016
Bro, you don't run php like client sided technologies like html and parts of javascript. You need local server installed, and run the program through localhost.

(1) (Reply)

Excel Resources Limited /erl / Convert My One Page PSD To Valid HTML, CSS & Javascript / I Need Who Can Help Me Upload My App To Play Store

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.