I'm trying to write a small shell script that access my database, retrieves some records and use them to edit the tags of my ogg files. I use exec to execute vobiscomment. If the title is not a variable, vorbiscomment renames the tag:
Code:
#!/usr/local/bin/php
<?php
$link = mysql_connect("localhost","root","");
mysql_select_db("Eliza");
$query = "select * from Eliza order by Title_ID limit 5";
$result = mysql_query($query) or die("Could not: $query");
while ($row = mysql_fetch_array($result))
{
print $row["Title"];
print "\n";
echo exec ('vorbiscomment -w -t title=Symphony 01.ogg');
print "\n";
print "\n";
}
?>
The result is as follows:
Code:
$ vorbiscomment -l 01.ogg
title=Symphony
$
However, if I set the title to be the variable, it doesn't work:
Code:
echo exec ('vorbiscomment -w -t title=$row["Title"] 01.ogg');
$ vorbiscomment -l 01.ogg
title=[Title]
$
Also, it doesn't work like this:
Code:
$title=$row["Title"];
echo exec ('vorbiscomment -w -t title=$title 01.ogg');
$ vorbiscomment -l 01.ogg
title=
$
Apparently, the problem is how to declare the variable.
Any suggestions?