Creating a table dynamically

    Date: 06/29/05 (Web Development)    Keywords: php, mysql, database, sql

    I'm running this bit of PHP script that I'm writing:
    $query = "CREATE TABLE 'mls" . $mls . "' ('id' INT NOT NULL AUTO_INCREMENT,'photo' VARCHAR(50) NOT NULL, PRIMARY KEY ('id'))";
    $result = mysql_query($query) or die("Query failed : " . mysql_error());

    The idea is that it's supposed to create a table named using a variable in the database. I would like to be able to dynamically create and drop tables as real estate listings are added and deleted. I just tried it out and it didn't work. No errors but the table didn't appear in the db when I went to look using phpMyAdmin. Is there something wrong with my code or is what I'm trying to do not possible?

    Source: http://www.livejournal.com/community/webdev/216628.html

« Section 508 compliance || Keeping news current »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home