Jump to content

need help creating sql


djclewes

Recommended Posts

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&#39;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>

Link to comment
Share on other sites

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&#39;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>

Link to comment
Share on other sites

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. 

 

 

 

 

 

 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.