First off, when you're setting a variable equal to a string, you have to put quotes around the string like this:
$x = "apple";
The first quote marks the beginning and the second quote marks the end.
The problem comes when you want to set a variable to a string that has quotes in it. For example, you want $q to equal:
Bob is a "nice" guy.
You can't write:
$q= "Bob is a "nice" guy.";
the quote just before the word nice is the second quote and ends the string and then you have the word nice just hanging out there and it creates an error.
So the correct way to do this is to write:
$q= "Bob is a \"nice\" guy.";
The backslash means, The quote should really be a quote, not a quote that ends the string.
So... you want to set $pulllogs equal to this:
mysql -A -e "use xxlog; call export_name($name,$date,'/logs/requestfromsite/$date.csv');"
so backslash the quotes and then wrap the whole thing in quotes like this:
$pulllogs = "mysql -A -e \"use xxlog; call export_name($name,$date,'/logs/requestfromsite/$date.csv');\"";
Ok, now that I've shown you how to do it, YOU SHOULD NEVER DO THIS. Seriously, allowing PHP to alter MySQL tables is a massive risk. Experienced coders stay away from this kind of thing. They find some other way to make it happen - you don't want to give this much power to the PHP page you're making.
The exec() command is to be used very very rarely. It's really just too dangerous to be using in normal everyday programming.
Imagine if someone claimed that their name was this:
asdf','Jan 1, 2011','/logs/request/Jan12011.csv'); drop table customers;
Try inserting that value in for $name in your exec() command.
Or worse, imagine if they said that their name was:
"; rm -rf *