Getting closer:

After fixing the form I get:

Add songs for Record Array
INSERT INTO songs VALUES (' blah', ' ***', ' ', ' 1', ' ')Songname[1]=:
blahblah
INSERT Failed, check the code.........

Here is the code:
$vals='';
for ($i=0; $i<= $songsinalbum; $i++) {
  $vals .=", ('$songname[$i]', '$rating[$i]', '$video[$i]', '$album_id[$i]',
    '$movie[$i]')";
}

// $vals=preg_replace("^,", "", $vals);
$vals=preg_replace('/^,/', '', $vals); // chop leading comma
//$vals=preg_replace('//^,/', '', $vals); // chop leading comma

$qry="INSERT INTO songs VALUES $vals";

echo $qry;

$res=mysql_query($qry);



Don Read wrote:

> On 14-Jul-01 David wrote:
> > Thanks for the help
> >
> > I tried your code and received error.
> >
> > Warning: No ending delimiter '^' found in addsongs.php on line 26
> > Songname: Array
> > INSERT Failed, check the code.........
> >
> > The code was: $vals=preg_replace('^,', '', $vals); // chop leading comma
> >
> > Is the ^ an escape character so you can enter a comma within ' '   ?
>
> No, in regular expressions that is the start of line, try it using
> doublequotes : preg_replace("^,", "", $vals);
>
> PHP is weird on this.
>
> Regards,
> --
> Don Read                                       [EMAIL PROTECTED]
> -- It's always darkest before the dawn. So if you are going to
>    steal the neighbor's newspaper, that's the time to do it.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to