ich für einige Nachrichtenartikel eine grundlegende CMS haben, enthält einige meiner Inhalte grundsätzlich Links alsMein Inhalt in einer MySQL-Datenbank Duplikate, wenn ich Artikel bearbeiten
<a href=""></a>
html so dass die Links hinzugefügt werden, wenn geschrieben Die Seite. Könnte das der Grund sein, dass meine Inhalte zufällig kopiert werden? wenn bearbeitet?
Hier ist der PHP, den ich benutze, um zu bearbeiten.
include'includes/connection.php';
$pName = $_POST['pName'];
$pItem = $_POST['pItem'];
$pCategory = $_POST['pCategory'];
$pDate = $_POST['pDate'];
$pAuthor = $_POST['pAuthor'];
$pContent = $_POST['pContent'];
$Page = $_POST['Page'];
$id = $_POST['id'];
$pApproval = $_POST['pApproval'];
$pPriority = $_POST['pPriority'];
$pImage_Name = $_POST['pImage_Name'];
if($pItem != 2){
$updateq = "UPDATE sitecontent SET ID = '$pID', Post_Title = '$pName', Post_Year = '$pCategory', Date = '$pDate', Post_Author = '$pAuthor', Post_Content = '$pContent', Page = '$Page', Post_Approval = '$pApproval', Priority = '$pPriority', Image_Name = '$pImage_Name' WHERE ID = '$_POST[id]'";
$result = mysql_query($updateq) or die (mysql_error());
header("Location:admin.php");
}
if($pCategory = 2){
$updateq = "UPDATE reviews SET review_id = '$pID', review_title = '$pName', review_category = '$pCategory', review_content = '$pContent', review_image = '$piName', review_approval = '$pApproval' WHERE ID = '$_POST[id]'";
$result = mysql_query($updateq) or die (mysql_error());
header("Location:reviews-category.php");
}
Dies ist die Seite vor, dass die Daten sendet.
<form action="editp.php" method="POST" name="editform">
<table cellpadding="10" >
<tr>
<td width="86" valign="top" >
<label for="pName" style="padding:10px; ">Post Title</label></td>
<td width="550">
<input type="text" name="pName" style=" width:550px;border:#000099; margin:10px;" value="<?php echo $post['Post_Title']; ?>"/>
</td>
</tr>
<tr>
<td width="86" valign="top" >
<label for="pCategory" style="padding:10px; ">Category</label></td>
<td width="550">
<input type="text" name="pCategory" style=" width:50px;border:#000099; margin:10px;" value="<?php echo $post['Post_Year']; ?>"/>
</td>
</tr>
<tr>
<td>
<label for="pItem" style="padding:10px;">Item Type</label>
</td>
<td>
<select name="pItem" style="border:#000099; margin:10px;">
<option value="1">News</option>
<option value="2">Review</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="pName" style="padding:10px;">Article ID</label>
</td>
<td>
<input type="text" name="pID" style="border:#000099; margin:10px;" value="<?php echo $post['ID']; ?>"/>
</td>
</tr>
<tr>
<td>
<label for="pName" style="padding:10px;">Post Date</label>
</td>
<td>
<input type="text" name="pDate" style="border:#000099; margin:10px;" value="<?php echo $post['Date']; ?>">
</td>
</tr>
<td>
<label for="pName" style="padding:10px;">Post Author</label>
</td>
<td>
<input type="text" name="pAuthor" style="border:#000099; margin:10px;" value="<?php echo $post['Post_Author']; ?>"/>
</td>
</tr>
<tr>
<td>
<label for="pName" style="padding:10px;">Home Page</label>
</td>
<td>
<select name="Page" style="border:#000099; margin:10px;">
<option value="0">None</option>
<option value="1">Home</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="pPriority" style="padding:10px;">Home Priority</label>
</td>
<td>
<select name="pPriority" style="border:#000099; margin:10px;">
<option value="0">None</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="pName" style="padding:10px;">Post Content</label>
</td>
<td>
<textarea style="width:550px; height:200px;border:#000099; margin:10px;" type="text" name="pContent" id="pContent" value="<?php echo $post['Post_Content']; ?>"><?php echo $post['Post_Content']; ?></textarea>
</td>
</tr>
<tr>
<td>
</td>
<td style="padding:10px;">
<span id="btnStrong" style=" padding: 2px 8px;background-color:#C00;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; color:#FFF; cursor:pointer;">Bold</span>
<span id="btnItalic" style=" padding: 2px 8px; background-color:#C00;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; color:#FFF; cursor:pointer;">Italic</span>
<span id="btnPara" style=" padding: 2px 8px; background-color:#C00;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; color:#FFF; cursor:pointer; margin-left:10px;">Paragraph</span>
<span id="btnBreak" style=" padding: 2px 8px; background-color:#C00;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; color:#FFF; cursor:pointer; margin-left:10px;">Line Break</span>
<span id="btnLink" style=" padding: 2px 8px;background-color:#C00;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; color:#FFF; cursor:pointer;">Link</span>
</td>
</tr>
<td>
<label for="pImage_Name" style="padding:10px;">Image Name</label>
</td>
<td>
<input type="text" name="pImage_Name" style="border:#000099; margin:10px; width:550px;" value="<?php echo $post['Image_Name']; ?>"/>
</td>
</tr>
<tr>
<td>
<label for="pApproval" style="padding:10px;">Approval</label>
</td>
<td>
<select name="pApproval" style="border:#000099; margin:10px;">
<option value="0">Pending</option>
<option value="1">Approved</option>
</select>
</td>
</tr>
<tr align="right">
<td><input type="hidden" name="id" value="<?php echo $_GET['id']; ?>"/></td>
<td colspan="2"><span style="margin-left:10px;">Please check the changes above before submitting</span><br/>
<input type="submit" name="go" value="Submit Changes" style=" padding: 2px 8px;background-color:#C00; color:#FFF; margin:10px;"/>
</td>
</tr>
</table>
</form>
Wenn du duplizierst, meinst du, dass die Zeile dupliziert ist oder der Inhalt in jeder Zelle dupliziert ist? – BenOfTheNorth
Sind Sie sicher, dass Sie 'if ($ pCategory = 2) {' und nicht: 'if ($ pCategory == 2) {'? – chown
Ich meine zufällige Bits von Text in meinem Varchar-Feld, wenn Inhalt gespeichert wird, wenn es auf meiner Seite schreibt, ist alles durcheinander. Es ist in Ordnung beim ersten Upload, aber wenn ich es bearbeite, vermasselt es. – huddds