Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    4
    Tokens
    0

    Default Help with PHP & SQL Coding

    Hi, i have a working timetable script but i've encountered errors whilst trying to develop an script which allows DJs to select a date and time and if the booked DJ's name matches their logged in account name the show deletes. Unfortunately it won't work and i was wondering if any1 could help.

    * The config file location and connection coding and information is correct.
    * The $logged and $POST parts retrive the information as i received it back in one error.
    * The table fields are correct.

    Bearing in mind that info, can any1 spot any errors in this coding and paste the correct one, thanks.

    -------------------------------------
    File name: delete_slot.php
    -------------------------------------
    <html>
    <head>
    </head>
    <body bgcolor="#47839D">
    <CENTER>
    <center><strong><font size="3" face="verdana" color="white"><u>Delete A Slot</u></Font></strong>
    <?php
    ob_start();
    include("../config.php");
    if($logged['username']);
    {
    if(!$_POST['posttime']) //have they submitted the form?
    {
    $date = date("m-y"); // the current date (only months and years)
    echo "
    <form onsubmit='return checkValues()' name='book' method='post'>
    <p><strong><font size=\"1\" face=\"verdana\" color=\"white\">DJ Name:</strong><br>
    DJ $logged[username] <br>
    </p>
    <p><strong>Date: *</strong>
    <select name='date' id='date'>
    <option value=\"select\">--- Please Select ---</option>
    <option>1-$date</option>
    <option>2-$date</option>
    <option>3-$date</option>
    <option>4-$date</option>
    <option>5-$date</option>
    <option>6-$date</option>
    <option>7-$date</option>
    <option>8-$date</option>
    <option>9-$date</option>
    <option>10-$date</option>
    <option>11-$date</option>
    <option>12-$date</option>
    <option>13-$date</option>
    <option>14-$date</option>
    <option>15-$date</option>
    <option>16-$date</option>
    <option>17-$date</option>
    <option>18-$date</option>
    <option>19-$date</option>
    <option>20-$date</option>
    <option>21-$date</option>
    <option>22-$date</option>
    <option>23-$date</option>
    <option>24-$date</option>
    <option>25-$date</option>
    <option>26-$date</option>
    <option>27-$date</option>
    <option>28-$date</option>
    <option>29-$date</option>
    <option>30-$date</option>
    <option>31-$date</option>
    </select>


    <br><br>
    <strong>Time: *</strong>
    <select name='time' id='time'>
    <option value=\"select\">--- Please Select ---</option>
    <option>12:00am</option>
    <option>1:00am</option>
    <option>2:00am</option>
    <option>3:00am</option>
    <option>4:00am</option>
    <option>5:00am</option>
    <option>6:00am</option>
    <option>7:00am</option>
    <option>8:00am</option>
    <option>9:00am</option>
    <option>10:00am</option>
    <option>11:00am</option>
    <option>12:00pm</option>
    <option>1:00pm</option>
    <option>2:00pm</option>
    <option>3:00pm</option>
    <option>4:00pm</option>
    <option>5:00pm</option>
    <option>6:00pm</option>
    <option>7:00pm</option>
    <option>8:00pm</option>
    <option>9:00pm</option>
    <option>10:00pm</option>
    <option>11:00pm</option>
    </select>
    <br>
    <br>
    <br>
    <input type='submit' name='posttime' value='Delete Slot'>
    </p>
    </form>
    <script language=\"JavaScript\">
    function checkValues() {
    if (document.book.date.value==\"select\") {
    alert(\"Please select a date!\");
    document.book.date.focus();
    return false; }
    if (document.book.time.value==\"select\") {
    alert(\"Please select a time!\");
    document.book.time.focus();
    return false; }
    document.book.submit(); }
    </script>

    * Required
    "; // the form its pretty easy to understand that bit
    }
    if ($_POST['posttime']) // have they posted the form?
    {
    $get = mysql_query("SELECT * FROM timetable");
    mysql_fetch_array("$get");
    $dj = $get['dj'];
    if ($logged['username'] == "$dj");
    {
    $time = $_POST['time'];
    $date = $_POST['date'];
    $username = $logged['username'];
    mysql_query("DELETE * FROM timetable WHERE date = '$date', time = '$time' and dj = '$username'")
    or die('MySQL said: ' . mysql_error());
    echo "<br><br>Thank You, your slot has been deleted"; //
    }
    }
    else {
    echo"This is not your show to delete!";
    }
    }
    ?>

  2. #2
    Join Date
    Jul 2006
    Posts
    4
    Tokens
    0

    Default

    I changed the coding to this, but i get the error Parse error:
    parse error, unexpected '\"' in /home/mini/public_html/djpanel/timenew/delete_show.php on line 113

    Can any1 help?

    code:

    <html>
    <head>
    </head>
    <body bgcolor="#47839D">
    <center>
    <center><strong><font size="3" face="verdana" color="white"><u>Delete A Slot</u></Font></strong>
    <?php
    ob_start();
    include("../config.php");

    if($logged['username']);
    {
    if(!$_POST['posttime']) //have they submitted the form?
    {
    $date = date("m-y"); // the current date (only months and years)
    echo("
    <form onsubmit='return checkValues()' name='book' method='post'>
    <p><strong><font size='1' face='verdana' color='white'>DJ Name:</strong><br>
    DJ $logged[username] <br>
    </p>
    <p><strong>Date: *</strong>
    <select name='date' id='date'>
    <option value='select'>--- Please Select ---</option>
    <option>1-$date</option>
    <option>2-$date</option>
    <option>3-$date</option>
    <option>4-$date</option>
    <option>5-$date</option>
    <option>6-$date</option>
    <option>7-$date</option>
    <option>8-$date</option>
    <option>9-$date</option>
    <option>10-$date</option>
    <option>11-$date</option>
    <option>12-$date</option>
    <option>13-$date</option>
    <option>14-$date</option>
    <option>15-$date</option>
    <option>16-$date</option>
    <option>17-$date</option>
    <option>18-$date</option>
    <option>19-$date</option>
    <option>20-$date</option>
    <option>21-$date</option>
    <option>22-$date</option>
    <option>23-$date</option>
    <option>24-$date</option>
    <option>25-$date</option>
    <option>26-$date</option>
    <option>27-$date</option>
    <option>28-$date</option>
    <option>29-$date</option>
    <option>30-$date</option>
    <option>31-$date</option>
    </select>


    <br><br>
    <strong>Time: *</strong>
    <select name='time' id='time'>
    <option value='select'>--- Please Select ---</option>
    <option>12:00am</option>
    <option>1:00am</option>
    <option>2:00am</option>
    <option>3:00am</option>
    <option>4:00am</option>
    <option>5:00am</option>
    <option>6:00am</option>
    <option>7:00am</option>
    <option>8:00am</option>
    <option>9:00am</option>
    <option>10:00am</option>
    <option>11:00am</option>
    <option>12:00pm</option>
    <option>1:00pm</option>
    <option>2:00pm</option>
    <option>3:00pm</option>
    <option>4:00pm</option>
    <option>5:00pm</option>
    <option>6:00pm</option>
    <option>7:00pm</option>
    <option>8:00pm</option>
    <option>9:00pm</option>
    <option>10:00pm</option>
    <option>11:00pm</option>
    </select>
    <br>
    <br>
    <br>
    <input type='submit' name='posttime' value='Delete Slot'>
    </p>
    </form>

    <script language='JavaScript'>
    function checkValues() {
    if (document.book.date.value=='select') {
    alert('Please select a date!');
    document.book.date.focus();
    return false; }
    if (document.book.time.value=='select') {
    alert('Please select a time!');
    document.book.time.focus();
    return false; }
    document.book.submit(); }
    </script>


    * Required");
    {
    $time = $_POST['time'];
    $date = $_POST['date'];
    $username = $logged['username'];
    $query = mysql_query "DELETE * FROM timetable WHERE date = '$date' AND time = '$time' AND dj = '$username'";
    mysql_query($query) or die('mysql said: ' . mysql_error());
    echo"<br><br>Thank You, your slot has been deleted";
    }
    }

    ?>

  3. #3
    Join Date
    Jul 2006
    Posts
    4
    Tokens
    0

    Default

    [quote=Foxeh]I changed the coding to this, but i get the error Parse error:
    parse error, unexpected '\"' in /home/mini/public_html/djpanel/timenew/delete_show.php on line 113

    Can any1 help?

    code:

    <html>
    <head>
    </head>
    <body bgcolor="#47839D">
    <center><strong><font size="3" face="verdana" color="white"><u>Delete A Slot</u></font></strong>
    <?
    ob_start();
    include("../config.php");
    if($logged['username']);
    {
    if(!$_POST['posttime']) //have they submitted the form?
    {
    $date = date("m-y");
    echo("
    <form onsubmit='return checkValues()' name='book' method='post'>
    <p><strong><font size='1' face='verdana' color='white'>DJ Name:</strong><br>
    DJ $logged[username] <br>
    </p>
    <p><strong>Date: *</strong>
    <select name='date' id='date'>
    <option value='select'>--- Please Select ---</option>
    <option>1-$date</option>
    <option>2-$date</option>
    <option>3-$date</option>
    <option>4-$date</option>
    <option>5-$date</option>
    <option>6-$date</option>
    <option>7-$date</option>
    <option>8-$date</option>
    <option>9-$date</option>
    <option>10-$date</option>
    <option>11-$date</option>
    <option>12-$date</option>
    <option>13-$date</option>
    <option>14-$date</option>
    <option>15-$date</option>
    <option>16-$date</option>
    <option>17-$date</option>
    <option>18-$date</option>
    <option>19-$date</option>
    <option>20-$date</option>
    <option>21-$date</option>
    <option>22-$date</option>
    <option>23-$date</option>
    <option>24-$date</option>
    <option>25-$date</option>
    <option>26-$date</option>
    <option>27-$date</option>
    <option>28-$date</option>
    <option>29-$date</option>
    <option>30-$date</option>
    <option>31-$date</option>
    </select>
    <br><br>
    <strong>Time: *</strong>
    <select name='time' id='time'>
    <option value='select'>--- Please Select ---</option>
    <option>12:00am</option>
    <option>1:00am</option>
    <option>2:00am</option>
    <option>3:00am</option>
    <option>4:00am</option>
    <option>5:00am</option>
    <option>6:00am</option>
    <option>7:00am</option>
    <option>8:00am</option>
    <option>9:00am</option>
    <option>10:00am</option>
    <option>11:00am</option>
    <option>12:00pm</option>
    <option>1:00pm</option>
    <option>2:00pm</option>
    <option>3:00pm</option>
    <option>4:00pm</option>
    <option>5:00pm</option>
    <option>6:00pm</option>
    <option>7:00pm</option>
    <option>8:00pm</option>
    <option>9:00pm</option>
    <option>10:00pm</option>
    <option>11:00pm</option>
    </select>
    <br>
    <br>
    <br>
    <input type='submit' name='posttime' value='Delete Slot'>
    </p>
    </form>
    <script language='JavaScript'>
    function checkValues() {
    if (document.book.date.value=='select') {
    alert('Please select a date!');
    document.book.date.focus();
    return false; }
    if (document.book.time.value=='select') {
    alert('Please select a time!');
    document.book.time.focus();
    return false; }
    document.book.submit(); }
    </script>
    * Required");
    }
    if ($_POST['posttime'])
    {
    $username = $logged['username'];
    $time = $_POST['time'];
    $date = $_POST['date'];
    $query = mysql_query("DELETE * FROM timetable WHERE dj = '$username' AND time = '$time' AND date = '$date'");
    mysql_query($query) or die('MySQL said: ' . mysql_error());
    echo"<br><br>Thank You, your slot has been deleted";
    }
    }
    ?>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •