简体   繁体   中英

Implementing Edit & Delete Buttons on MySQL Database with PHP

Im trying to add edit and delete buttons to a html table containing values from a MySQL database which simply POST the "eventID" to the relevent php page. Struggling to make it work and any help would be very much appreciated!

My code looks like

<tr><th>Title</th><th>Date</th></tr>
<?php
require_once("./includes/connection.inc.php");
$conn = dbConnect();
$eventID = MSF::getInstance()->get_event_id_by_name($_SESSION["user"]);
$result = MSF::getInstance()->get_events_by_event_id($eventID);
while($row = mysqli_fetch_array($result)):
    echo "<tr><td>" . htmlentities($row['title']) . "</td>";
    echo "<td>" . htmlentities($row['date']) . "</td>";
    $eventID = $row["id"];
?>
<td>
    <form name="editEvent" action="editEvent.php" method="GET">
        <input type="hidden" name="eventID" value="<?php echo $eventID; ?>"/>
        <input type="submit" name="editEvent" value="Edit"/>
    </form>
</td>
<td>
    <form name="deleteEvent" action="deleteEvent.php" method="POST">
        <input type="hidden" name="eventID" value="<?php echo $eventID; ?>"/>
        <input type="submit" name="deleteEvent" value="Delete"/>
    </form>
</td>
<?php
echo "</tr>\n";
endwhile;
mysqli_free_result($result);
?>

all I get currently is this error message from the browser

"Fatal error: Class 'MSF' not found in /Applications/XAMPP/xamppfiles/htdocs/msf/editEvent.php on line 14"

It dosen't seem to find the database and i think im doing something wrong just after the dbConnect(); statement.

Any help would be great! Thanks!

似乎您也应该require声明MSF类的文件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM