• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED simple sql query doesn't work

RobertS

New member
Messages
7
Likes
0
Points
1
#1
Hi,
hopefully not again a "dummy in front of the screen" question...

The simple sql squery
Code:
select count(*) from view_test where Geschlecht = "M"
or alternative
select count(*) from view_test where Geschlecht = 'M';
works well from sql side and returns the right count.

If I insert this into a snippet like
Code:
$sql2 = "SELECT COUNT(*) FROM view_test WHERE Geschlecht = "W"";
I get a warning from the internal syntax checker.

Trying
Code:
$sql2 = "SELECT COUNT(*) FROM view_test WHERE Geschlecht = 'W'";
I get a WordPress error page
 

RobertS

New member
Messages
7
Likes
0
Points
1
#2
SOLVED - even it is just one Number the value is an array.
Converting the array with mysqli_fetch_assoc did the job.