Hi

I'm storing a MySql table name in a PHP variable e.g.

$tbl = "example".$coy;

Why does:
$sql_command = ("SELECT * FROM '<?php echo $tbl; ?>' WHERE id = '$id'");
not work? Is there a way to do it? I unfortunately HAVE to store the table name in a variable cuz it is different for different companies.

Thanks

    $sql_command = ("SELECT * FROM '<?php echo $tbl; ?>' WHERE id = '$id'");

    why did you do <?php echo $tbl; ?> ? you should have php tags already...
    try this:
    $sql_command = ("SELECT * FROM $tbl WHERE id = '$id'");

      Thanks.. I was confused with the syntax.. sorry!

        Write a Reply...