bamfon Posted January 8, 2011 Share Posted January 8, 2011 <?php include "./config.php"; if(isset($_POST['name'])) { $sql = 'CREATE TABLE `'.$_POST['name'].'` ( `ep` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(150) NOT NULL, `type` varchar(150) NOT NULL, `episode` varchar(150) NOT NULL, `year` varchar(150) NOT NULL, `status` varchar(150) NOT NULL, `summary` varchar(150) NOT NULL, PRIMARY KEY (`ep`) )'; $king = $_POST['name']; error_reporting(E_ALL); ini_set('display_errors', '1'); }?> <?php $title = $_POST['title']; $type = $_POST['type']; $episodes = $_POST['episodes']; $year = $_POST['year']; $genre = $_POST['genre']; $status = $_POST['status']; $summary = $_POST['summary']; $pic = $_POST['pic']; $sql="INSERT INTO $king (title, type, episode, year, genre, status, summary, pic) VALUES ('$title','$type','$episodes','$year','$genre','$status','$summary','$pic')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "1 Anime added"; error_reporting(E_ALL); ini_set('display_errors', '1'); ?> i want it delay everything after $title = $_POST['title']; so it has time to save the table before adding in the info i tryed using sleep but it dont work Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/ Share on other sites More sharing options...
Pikachu2000 Posted January 8, 2011 Share Posted January 8, 2011 Why are you creating a new table every time that form is submitted? Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/#findComment-1156730 Share on other sites More sharing options...
bamfon Posted January 8, 2011 Author Share Posted January 8, 2011 Why are you creating a new table every time that form is submitted? well the form is for making new tables for anime. Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/#findComment-1156732 Share on other sites More sharing options...
Pikachu2000 Posted January 8, 2011 Share Posted January 8, 2011 That's a horrible database design. What are your goals with this, so we can help you figure out how to get this set up and working properly? Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/#findComment-1156736 Share on other sites More sharing options...
bamfon Posted January 8, 2011 Author Share Posted January 8, 2011 well i am going to have 1 table per an anime, using that form i will make the anime make a new table. then i got another part i am working that will add in the data for the table. The thing overall is like a cms for an anime site Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/#findComment-1156746 Share on other sites More sharing options...
Anti-Moronic Posted January 8, 2011 Share Posted January 8, 2011 No, it's a nightmare way to design a database. From what I can see, you should only need a few tables. table_anime table_anime_episodes table_categories You can easily create a relationship between these tables without creating a new table per anime. Imagine if you insert 10,000 anime shows..by your current design you will be creating 10,000 tables. Cmon, surely you can see there must be a better way? That better way is above ^^ table_anime has an id, which is refered to in tabel_anime_episodes, table_categories has an id which is refered to in table_anime. Something like: table_anime.ID = table_anime_episodes.anime_ID table_anime.cat_ID = table_categories.ID Now you can insert a MILLION anime shows (not sure if that many exist and you will be able to manage the data *with ease*. If you're not careful you are going to create for yourself a big big headache. Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/#findComment-1156755 Share on other sites More sharing options...
Zurev Posted January 8, 2011 Share Posted January 8, 2011 <?php include "./config.php"; if(isset($_POST['name'])) { $sql = 'CREATE TABLE `'.$_POST['name'].'` ( `ep` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(150) NOT NULL, `type` varchar(150) NOT NULL, `episode` varchar(150) NOT NULL, `year` varchar(150) NOT NULL, `status` varchar(150) NOT NULL, `summary` varchar(150) NOT NULL, PRIMARY KEY (`ep`) )'; $king = $_POST['name']; error_reporting(E_ALL); ini_set('display_errors', '1'); }?> <?php $title = $_POST['title']; $type = $_POST['type']; $episodes = $_POST['episodes']; $year = $_POST['year']; $genre = $_POST['genre']; $status = $_POST['status']; $summary = $_POST['summary']; $pic = $_POST['pic']; $sql="INSERT INTO $king (title, type, episode, year, genre, status, summary, pic) VALUES ('$title','$type','$episodes','$year','$genre','$status','$summary','$pic')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "1 Anime added"; error_reporting(E_ALL); ini_set('display_errors', '1'); ?> i want it delay everything after $title = $_POST['title']; so it has time to save the table before adding in the info i tryed using sleep but it dont work I fully agree with anti-moronic, also....: so it has time to save the table before adding in the info Come on, admit it, you just want it to say "Creating table...." THEN say Done or something...right, please? You realize it'll hang until it completes it, or die due to syntax/maximum execution time/memory exceeded/whatever. Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/#findComment-1156758 Share on other sites More sharing options...
bamfon Posted January 8, 2011 Author Share Posted January 8, 2011 Come on, admit it, you just want it to say "Creating table...." THEN say Done or something...right, please? You realize it'll hang until it completes it, or die due to syntax/maximum execution time/memory exceeded/whatever. I really dont Also thanks Anti-Moronic i will look in to doing it that way Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/#findComment-1156774 Share on other sites More sharing options...
Anti-Moronic Posted January 8, 2011 Share Posted January 8, 2011 Come on, admit it, you just want it to say "Creating table...." THEN say Done or something...right, please? You realize it'll hang until it completes it, or die due to syntax/maximum execution time/memory exceeded/whatever. I really dont Also thanks Anti-Moronic i will look in to doing it that way No problem. Please do come back if you have trouble implementing things this way! Be glad to help. Link to comment https://forums.phpfreaks.com/topic/223796-dalying-php/#findComment-1156780 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.