如何立即在php的diffrent表中更新数据

时间:2016-11-07 05:03:12

标签: php html

我有一个名为tyneevents 3 table的数据库 te_category,其中包含catID(用于categoryID)和catDesc(用于类别描述)。
te_venue有sceneID,venueName和location te_events,包含eventID,eventTitle,eventDescription,venueID,catID,eventStartDate,eventEndDatae和eventPrice。
我有一个名为allDetails.php的页面来编辑eventDetails 编辑后,它传递给另一个名为updateEventDetail.php的页面 这是updateEventDetail.php代码。

<?php   
    include "database_conn.php";


    //get all data submited
        $id         = $_GET ["eventID"];
        $title      = $_GET ["eventTitle"];
        $desc       = $_GET ["eventDescription"];
        $venue      = $_GET ["venueName"];
        $location   = $_GET ["location"];
        $category   = $_GET ["catDesc"];
        $eStart     = $_GET ["eventStartDate"];
        $eEnd       = $_GET ["eventEndDate"];
        $ePrice     = $_GET ["eventPrice"];

        $sqlUpdateEvent             = " UPDATE te_events SET
                 eventTitle         = '$title' ,
                 eventDescription   = '$desc' ,
                 catDesc            = '$category' ,
                 venueName          = '$venue' ,
                 location           = '$location' ,
                 eventStartDate     = '$eStart' ,
                 eventEndDate       = '$eEnd' , 
                 eventPrice         = '$ePrice' 
                 WHERE eventID      =  $id";

        mysqli_query ($conn , $sqlUpdateEvent)
            or die ("SQL ERROR :".mysqli_error($conn));
?>

<!DOCTYPE html>
<html lang="en">
<head>
<title>update mvie comfirmmation</title>
<meta charset="utf-8">
</head>
<body>
<h1>update mvoie detials</h1>

<?php 

    echo "Title : $eventTitle \n";
    echo "Category : $catDesc \n";
    echo "Description : $eventDescription \n";
    echo "Venue : $venueName \n";
    echo "Location : $location \n";
    echo "Start Date : $eventStartDate \n";
    echo "End Date : $eventEndDate \n";
    echo "Price : $eventPrice \n";

    if(mysqli_affected_rows($conn)>0)
        echo "<p> Event update successfully </p>\n";
    else
        echo "<p> Update Fail</p>\n";

?>

<a href = "admin.php">Choose Event</a>
</body>
</html>
<?php
    mysqli_close($conn);
?>

问题表明

  

SQL错误:未知列&#39; catDesc&#39; &#39;场地&#39; &#39;位置&#39;在&#39;领域   列表&#39;

好像在我的数据库中找不到该表。

1 个答案:

答案 0 :(得分:0)

te_events 仅包含eventID,eventTitle,eventDescription,venueID,catID,eventStartDate,eventEndDatae和eventPrice。     这些catDesc&#39; &#39;场地&#39; &#39;位置&#39;在另外两个表中。