djclewes Posted May 8, 2012 Share Posted May 8, 2012 Hi i am needing help creating a database which will work with the following code. can anyone help <OPTION VALUE="Enter new DJ NAME...">Add New DJ!</OPTION> </select> </td> </tr> <tr> <td align="right">DJ's Full Name: </td> <td align="left"> <input type='text' id='djName' name='djName' size='35' value="<? echo $_SESSION['currentname']; ?>" /> </td> </tr> <tr> <td align="right">DJs Nickname:</td> <td align="left"><input name='djDescription' type='text' id='djNickname' size='35' maxlength="100" value="<? echo $_SESSION['currentnickname']; ?>" /></td> </tr> <tr> <td align="right">Description:</td> <td align="left"><input name='djDescription' type='text' id='djDescription' size='35' maxlength="100" value="<? echo $_SESSION['currentdesc']; ?>" /></td> </tr> <tr> <td align="right">DJs Picture:</td> <td align="left"><input type='file' id='djpicture' name='djpicture' size='35' value="<? echo $_SESSION['currentpicture']; ?>" /></td> </tr> <tr> <td align="right">DJs Show Promo Picture:</td> <td align="left"><input type='file' id='promopicture' name='promopicture' size='35' value="<? echo $_SESSION['currentpromopicture']; ?>" /></td> </tr> <tr> <td align="right">Add New Scheduled Shift for this DJ:</td> <td> <select id="djNewDay" name="djNewDay"> <option value="1">Sunday</option> <option value="2">Monday</option> <option value="3">Tuesday</option> <option value="4">Wednesday</option> <option value="5">Thurday</option> <option value="6">Friday</option> <option value="7">Saturday</option> </select> <select id="djNewShift" name="djNewShift"> <option value="0000">0000 to 0600</option> <option value="0600">0600 to 0900</option> <option value="0900">0900 to 1200</option> <option value="1200">1200 to 1400</option> <option value="0000">1400 to 1600</option> <option value="0000">1600 to 1800</option> <option value="0000">1800 to 2000</option> <option value="0000">2000 to 2100</option> <option value="0000">2100 to 2200</option> <option value="0000">2200 to 2400</option> </select> <input type="submit" name="addschedule" value="Add New Schedule for this DJ!"> </td> </tr> <tr> <td align="right"> Updated On:</td> <td align="left"><input type='text' id='lastUpdated' name='lastUpdated' size='35' value="<? echo $_SESSION['lastupded']; ?>" readonly /></td> </tr> <tr> <td align="center" colspan="2" height="40"><input type="submit" id="updateDJ" name="updateDJ" value="Update This DJ!" /> <input type="submit" id="deleteDJ" name="deleteDJ" value="Delete This DJ!" /></td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/ Share on other sites More sharing options...
gizmola Posted May 8, 2012 Share Posted May 8, 2012 Do you have a specific question? Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1343896 Share on other sites More sharing options...
djclewes Posted May 8, 2012 Author Share Posted May 8, 2012 Do you have a specific question? yeah io need to know how to create a database query to get the following script to work i am new to mysql so thats why i am posting the code. can you help create the query for it please <OPTION VALUE="Enter new DJ NAME...">Add New DJ!</OPTION> </select> </td> </tr> <tr> <td align="right">DJ's Full Name: </td> <td align="left"> <input type='text' id='djName' name='djName' size='35' value="<? echo $_SESSION['currentname']; ?>" /> </td> </tr> <tr> <td align="right">DJs Nickname:</td> <td align="left"><input name='djDescription' type='text' id='djNickname' size='35' maxlength="100" value="<? echo $_SESSION['currentnickname']; ?>" /></td> </tr> <tr> <td align="right">Description:</td> <td align="left"><input name='djDescription' type='text' id='djDescription' size='35' maxlength="100" value="<? echo $_SESSION['currentdesc']; ?>" /></td> </tr> <tr> <td align="right">DJs Picture:</td> <td align="left"><input type='file' id='djpicture' name='djpicture' size='35' value="<? echo $_SESSION['currentpicture']; ?>" /></td> </tr> <tr> <td align="right">DJs Show Promo Picture:</td> <td align="left"><input type='file' id='promopicture' name='promopicture' size='35' value="<? echo $_SESSION['currentpromopicture']; ?>" /></td> </tr> <tr> <td align="right">Add New Scheduled Shift for this DJ:</td> <td> <select id="djNewDay" name="djNewDay"> <option value="1">Sunday</option> <option value="2">Monday</option> <option value="3">Tuesday</option> <option value="4">Wednesday</option> <option value="5">Thurday</option> <option value="6">Friday</option> <option value="7">Saturday</option> </select> <select id="djNewShift" name="djNewShift"> <option value="0000">0000 to 0600</option> <option value="0600">0600 to 0900</option> <option value="0900">0900 to 1200</option> <option value="1200">1200 to 1400</option> <option value="0000">1400 to 1600</option> <option value="0000">1600 to 1800</option> <option value="0000">1800 to 2000</option> <option value="0000">2000 to 2100</option> <option value="0000">2100 to 2200</option> <option value="0000">2200 to 2400</option> </select> <input type="submit" name="addschedule" value="Add New Schedule for this DJ!"> </td> </tr> <tr> <td align="right"> Updated On:</td> <td align="left"><input type='text' id='lastUpdated' name='lastUpdated' size='35' value="<? echo $_SESSION['lastupded']; ?>" readonly /></td> </tr> <tr> <td align="center" colspan="2" height="40"><input type="submit" id="updateDJ" name="updateDJ" value="Update This DJ!" /> <input type="submit" id="deleteDJ" name="deleteDJ" value="Delete This DJ!" /></td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1343898 Share on other sites More sharing options...
gizmola Posted May 8, 2012 Share Posted May 8, 2012 You seem to misunderstand what the word specific means. Pasting a form with a few random session variables in it, is not going to help anyone answer your question. The fact that you pasted the same code TWICE for no reason, is annoying. Please don't do it again. We have code and php tags you can use, to make your code snippets easier to read. Bottom line: you need to break this down into small pieces with questions that people can answer for you. We answer questions to help people learn and develop code. We don't write the code for you. Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1343904 Share on other sites More sharing options...
djclewes Posted May 8, 2012 Author Share Posted May 8, 2012 ok try again i need help creating the two tables below in MySQL... TABLE1: presenters FIELDS: ID (auto-increment) djname (text) djnickname (text) djdesc (text) djpicture (text) djshowpicture (text) TABLE2: shifts FIELDS: ID (auto-increment) presenter (INT) day (text) hours (text) Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1343906 Share on other sites More sharing options...
gizmola Posted May 8, 2012 Share Posted May 8, 2012 Ok, so you need to write DDL for the tables. You need to figure out the MySQL datatypes you need. -For name and nickname, this would be varchar(#) where # is the maximum number of characters you'll need. -For djdesc this could be either varchar() or text. Which you choose depends on the amount of text you'll be storing. Typically people use text for reasons I won't go into, but if you will only allow a few paragraphs of text, you might want to use a varchar(2048) and can go as far as 64k characters, but that hits up against the size limit of a single row. -djpicture should probably also be a varchar. It is possible to store the actual image data inside the database, but typically people do not do that, and instead store the path to the image file, and store it on their server in a specific location. -djshowpicture, I assume is a flag that indicates if the picture should be shown? If so, use a tinyint. For shifts, it would help if you could elaborate on what the system is trying to do. For example, if you are going to use this as the basis for a scheduling application, you might be much better off using mysql datetime columns and having shifts be: id integer presenter_id integer from datetime to datetime To actually create a table, you simply issue a CREATE TABLE command. There are plenty of references and tutorials how to do this, but you'd want something for the presenters table like: CREATE TABLE presenter ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, djname VARCHAR(80), djnickname VARCHAR(40), djdesc TEXT, djpicture VARCHAR(128), djshowpicture TINYINT UNSIGNED DEFAULT 1, CONSTRAINT PK_presenter PRIMARY KEY (id) ) engine=innodb; This should help you get started. Google for "mysql create table" for more detail. Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1343911 Share on other sites More sharing options...
djclewes Posted May 8, 2012 Author Share Posted May 8, 2012 i am getting <? echo $_SESSION['currentname']; ?> <? echo $_SESSION['currentnickname']; <? echo $_SESSION['currentdesc']; ?> <? echo $_SESSION['lastupded']; ?> errors Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1343912 Share on other sites More sharing options...
Barand Posted May 8, 2012 Share Posted May 8, 2012 For the benefit of those here who have no psychic powers, could you explain what type of error. What is happening that shouldn't happen? What is not happening that should? Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1343917 Share on other sites More sharing options...
djclewes Posted May 8, 2012 Author Share Posted May 8, 2012 i think it be better if you all just visited the link http://lcradio.co.uk/test/djadmin.htm Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1343921 Share on other sites More sharing options...
gizmola Posted May 8, 2012 Share Posted May 8, 2012 Well if you are asking why the session code doesn't work, it is because this is not a .php script, it's .htm. Quote Link to comment https://forums.phpfreaks.com/topic/262242-need-help-creating-sql/#findComment-1344104 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.