i'm using (i think!) a MySQL Subquery as a Scalar Operand syntax. as you will see below, i am checking 3 fields of one table using two subqueries within a MySQL SELECT query. i've encountered a mysql_error() which states that, because i have more than one result returned true,
Warning: mysql_query() [function.mysql-query]: Unable to save result set in C:\Apache...\artist_dates.php on line 16
Subquery returns more than 1 row
. so, although i'm narrowing down my problem as to how i am going to tell my user whether an Artist has any concerts scheduled, and since, if the Artist does have dates scheduled, the purpose of this script is to list the concert date, or dates, i was expecting to use that query to let the script proceed to the next section, which is to use WHILE arrays to list those dates. but, my script stalls because i am unable to store the multiple subquery results as i normally would as in $results = mysql_query($variable); where $variable in this case is my SELECT query and subqueries.
here's a chunk of the script so you can see how i'm trying to do it currently:
$checkinids = "select (select (select show_date from concerts where artist_id1=$artid)
show_date from concerts where artist_id2=$artid)
show_date from concerts where artist_id3=$artid";
$checkinres = mysql_query($checkinids, $conn) or die(mysql_error());
$checkinnum = mysql_num_rows($checkinres) or die(mysql_error());
if ($checkinnum == 0 ) {
$htmloutput = "<h1>Sorry, no Concerts Scheduled for $var2<h1>";
} else if ($checkinnum >= 1) {
function getdates() {
global $conn;
$seldates = "SELECT DATE_FORMAT(show_date, '%W, %M %D, %Y') AS formatted_date FROM concerts where artist_id1 =$_GET[var]";
$datesres = mysql_query($seldates, $conn) or die(mysql_error());
return $datesres;
}