SQL语句PHP / SQLite中的2个变量

I have an AJAX request, which passes two variables

data: {name:name,ubu:ubu}

and I fetch them in PHP as

$name= $_GET['name'];
$ubu= $_GET['ubu'];

and insert them into a SQL-Statement for my SQLite database

$query = "SELECT '$ubu' FROM '$name'";

But the first variable refuses to work. If I replace the '$ubu' in the query with the rowname, it works like a charm, and I can change the $name from the AJAX side. What am I missing here?

EDIT: Well, just as I posted this, I found a way:

$query = "SELECT "  .$ubu. " FROM '$name'";

Probably not the best way to do it, but at least it works now :)