. */ ####################################### ### Update Address Book (ab_bodies) ### ####################################### if( $rundaily!="yes" ) { // no access exit(); } $out.="\n\n=== Creating dummy events ===\n"; // Load the eventcodes for which we have books existing $query="SELECT `eventcode`, COUNT(`id`) AS `count` FROM `book` WHERE `uid`=0 AND `photocount`=0 AND `title`='Empty dummy book' GROUP BY `eventcode`"; if( @mysql_num_rows( $res=doquery($query) )>0 ) { $books=array(); $books[]="dummy"; while( $row=mysql_fetch_array($res) ) { #$out.="Number of books for ".$row['eventcode'].": ".$row['count']."\n"; $books[]=$row['eventcode']; } // Check if the event has a book linked to it, if not, create a dummy $query="SELECT `eventcode` FROM `event`"; if( @mysql_num_rows( $res=doquery($query) )>0 ) { while( $row=mysql_fetch_array($res) ) { if( !array_search($row['eventcode'], $books) ) { // Event does not have any book connected to it $query2="INSERT INTO `book` (`uid`, `eventcode`, `photocount`, `title`) VALUES (0, '".addslashes($row['eventcode'])."', 0, 'Empty dummy book')"; if( doquery($query2) ) { $out.="Inserted dummy book for: ".$row['eventcode']."\n"; }else { $out.="Failed inserting dummy book for: ".$row['eventcode']."\n"; } } } } } ?>