خرید بک لینک

Vote count: 0

I put together a form to submit data into a MySQL database. It worked before just fine I get an error - no response from mysqli coection but no mysql_error appears.

I understand there is some room here from SQL injection - please discard that.

Coection PHP Page

<?php
  define('DB_SERVER', 'localhost');
  define('DB_USERNAME', 'root');
  define('DB_PASSWORD', 'root');
  define('DB_DATABASE', 'holidash');
    $db = mysqli_coect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
?>

Form PHP Page

    <form action= "submitdowntime.php" method="post" id="createDowntime" data-parsley-validate class="form-horizontal form-label-left">

                                <div class="form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12">Attraction <span class="required">*</span> </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <select name="fattraction" class="select2_single form-control" tabindex="-1" id="fAttraction" required="required">
                                            <option></option>
                                            <?php

                                                    // coect to the database
                                                    include_once('coection.php');

                                                    // get results from database
                                                    $query = "SELECT *
                                                    FROM attractionslist
                                                    ORDER BY attractionslist.attName ASC";

                                                    $response = mysqli_query($db, $query);

                                                    // loop through results of database query, displaying them in the table
                                                    while($row = mysqli_fetch_array($response)){

                                                        // echo out the contents of each row
                                                        echo '<option value="' . $row['id'] . '">';
                                                        echo '' . $row['attName'] . '';
                                                        echo "</option>";
                                                    }
                                            ?>
                                        </select>
                                    </div>
                                </div>

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Date">Date <span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="date" id="fDate" name="fDate" required="required" class="form-control col-md-7 col-xs-12" value="<?php echo date("Y-m-d");?>">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="downtime">Downtime <span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="time" id="fDowntime" name="fDowntime" value="<?php $time = date('H:i');  echo $time; ?>" required="required" class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>


                            <div class="form-group" data-toggle="buttons">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="last-name">Status: <span class="required">*</span>
                                </label>
                                <label class="btn btn-default">
                                    <input type="radio" name="fstatus" required="required" id="option1" value="RD"> RD
                                </label>
                                <label class="btn btn-default">
                                    <input type="radio" name="fstatus" id="option2" value="RD 1"> RD 1
                                </label>
                                <label class="btn btn-default">
                                    <input type="radio" name="fstatus" id="option3" value="RD 2"> RD 2
                                </label>
                                <label class="btn btn-default">
                                    <input type="radio" name="fstatus" id="option4" value="RD - Opening Late"> RD - Opening Late
                                </label>
                                <label class="btn btn-default">
                                    <input type="radio" name="fstatus" id="option5" value="Code O"> Code O
                                </label>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12">Reason
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <textarea id="fnotes" name="fnotes" class="resizable_textarea form-control" placeholder="Brief discription of the issue.."></textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12">Ops Response <span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input id="fopsresponse" name="fopsresponse" class="date-picker form-control col-md-7 col-xs-12" required="required" type="text">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12">Maint Response <span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input id="fmaintresponse" name="fmaintresponse"class="date-picker form-control col-md-7 col-xs-12" required="required" type="text">
                                </div>
                            </div>

                            <div class="ln_solid"></div>

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="ClearofGuests">Clear of Guests
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="time" id="fClearOfGuests" name="fclearofguests" class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="last-name">Code O
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="time" id="fOpeningTime" name="fopeningtime" class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>

                                <div class="ln_solid"></div>


                            <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-5">
                                    <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                            </div>

                        </form>

Submit Form PHP

<?php
$fattraction = $_POST['fattraction'];
$fdate = $_POST["fDate"];
$fdowntime = $_POST["fDowntime"];
$fstatus = $_POST["fstatus"];
$fnotes = $_POST["fnotes"];
$fopsresponse = $_POST["fopsresponse"];
$fmaintresponse = $_POST["fmaintresponse"];
$fclearofguests = $_POST["fclearofguests"];
$fopeningtime = $_POST["fopeningtime"];


$startTime = date('Y-m-d H:i:s', strtotime("$fdate $fdowntime"));  // Merging date/time for 'fdowntime'

// db coection
include_once('coection.php');

$query = "INSERT INTO attractionsdowntime (attractionid, attStatus, startTime, notes, userid, isOnHold, attRadioNumber, maintRadioNumber)
VALUES ('$fattraction','$fstatus', '$startTime', '$fnotes', '$login_id', '1', '$fopsresponse', '$fmaintresponse')";

    $response = mysqli_query($db, $query);

if ($response)
  echo '<p> Entry Recorded <p> <br /> <a href="javascript:history.back()">Go Back</a>';
else
  echo "Problem updating record. MySQL Error: " . mysql_error();
?>

On form submission I receive Problem updating record. MySQL Error: with no error.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 18 مرداد 1395 ساعت: 8:45

صفحه بندی