Problem creating-inserting to a table
Posted: Thu Nov 10, 2005 9:25 pm
feyd | Please use
Thanks guys!!
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
This is probably something really simple I just can't see. This is just for an admin page of a script I am working on. This part is supposed to create a table (from a variable), grab the files names of a directory on my server, then insert the file names into the new table.
It is creating the table, but not inserting the data. Before I had it creating the table, it was inserting the data into existing tables fine. So its some conflict or something but I just don't see it.Code: Select all
<?
$db = "******";
$user = "*****";
$pw = "******";
if($email) {
$mysql_access = mysql_connect("localhost", $user, $pw);
mysql_select_db($db, $mysql_access);
$rot = "../members/galleries/tmp_" . $email . "/";
$folder=dir($rot);
// create table $email and insert the $folderentries
$quer = "CREATE TABLE `$email` (`id` INT( 3 ) NOT NULL AUTO_INCREMENT , `filename` VARCHAR( 10 ) NOT NULL , PRIMARY KEY ( `id` ) ,UNIQUE (`filename` )) ";
mysql_query($quer, $mysql_access);
while($folderEntry=$folder->read()){
if($folderEntry != "." && $folderEntry != ".." && $folderEntry != "index.htm" && $folderEntry != "large" && $folderEntry != "small")
{
$query = "INSERT INTO '$email' ";
$query .= "VALUES('0', '$folderEntry')";
mysql_query($query, $mysql_access);
}
else
{
}
}
// rename directory from tmp_$email to $email
rename("../members/galleries/tmp_" . $email . "/", "../members/galleries/" . $email . "/");
// insert it into gallerylist table (not done yet)
print("done");
} else {
print("<form method='POST' action='addgal.php'>");
print("Please enter gallery number: ");
print("<input type='text' name='email' size='10'>");
print("<input type='submit' value='submit'></form>");
}
?>Thanks guys!!
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]