Code: Select all
echo "Uncut query: $query2 <p>";
$query2=substr($query2,0,-1); //should just get rid of the last character?
echo "Cut query: $query2<p>";Uncut query: INSERT INTO `caldate`(`startdate`,`enddate`,`starttime`,`endtime`,`event_id`) VALUES('2007-03-19','2007-03-19','00:00','12:00','41'), ('2007-03-20','2007-03-20','00:00','12:00','41'), ('2007-03-21','2007-03-21','00:00','12:00','41'), ('2007-03-22','2007-03-22','00:00','12:00','41'), ('2007-03-23','2007-03-23','00:00','12:00','41'), ('2007-03-24','2007-03-24','00:00','12:00','41'),
Cut query: INSERT INTO `caldate`(`startdate`,`enddate`,`starttime`,`endtime`,`event_id`) VALUES('2007-03-19','2007-03-19','00:00','12:00','41'), ('2007-03-20','2007-03-20','00:00','12:00','41'), ('2007-03-21','2007-03-21','00:00','12:00','41'), ('2007-03-22','2007-03-22','00:00','12:00','41'), ('2007-03-23','2007-03-23','00:00','12:00','41'), ('2007-03-24','2007-03-24','00:00','12:00','41'),
which kills the mysql_query because of the last comma.
So what have I done wrong? The manual has this!
Code: Select all
$rest = substr("abcdef", 0, -1); // returns "abcde"