Try this code It will help you... Take Table name separatly as variable and put variable in mysql query
<?php
$con= mysql_connect("your host","username","password");
$db=mysql_select_db("Your database");
$tableName = $username."-log";
$newlogforuser="CREATE TABLE '".$tableName."'(date CHAR(30),time CHAR(30),ipaddress CHAR(30))";
$sqlst=mysql_query($con,$newlogforuser);
if($sqlst)
{
echo "Response from server: Log created successfully";}
else { echo "Response from server: Error creating log: " . mysql_error();
}
?>