Forum Moderators: coopster

Message Too Old, No Replies

Query error: Database query failed: Operand should contain 1 column(s)

         

kssi89

2:10 pm on Apr 10, 2009 (gmt 0)

10+ Year Member



Hello everyone!

I've been trying to put together a script that will broadcast an email message to multiple addresses in the database through an array; however, my query is failing. The error generated by MySQL is: Operand should contain 1 column(s).

Here is my query part of the code:

$query = "SELECT (last_name, first_name, mother, father,".
"mom_email, dad_email, personal_email,".
"preferred_email) FROM player";
$result = mysql_query($query, $connection)
or die("Database query failed: " . mysql_error());

Any thoughts are appreciated!

d40sithui

2:39 pm on Apr 10, 2009 (gmt 0)

10+ Year Member



You're getting that error because you used parenthesis where you didn't need them.
Should be::

$query = "SELECT last_name, first_name, mother, father,".
"mom_email, dad_email, personal_email,".
"preferred_email FROM player";

coopster

3:38 pm on Apr 10, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Bingo. And welcome to WebmasterWorld, kssi89.

kssi89

2:22 pm on Apr 16, 2009 (gmt 0)

10+ Year Member



Thank you!