Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate/edit Rows in Database via PHP
    primarykey
    data
    text
    <p>I am trying to make a script so selected rows in my database can be editted. </p> <p>Though I am having no Luck. </p> <p>Can some explain where Ive gone wrong please?</p> <p>DATABASE INFO: </p> <p>id</p> <p>Name </p> <p>Type</p> <p>MadeBy </p> <p>Submitted </p> <p>text </p> <p>date </p> <p>key 1</p> <p>key 2</p> <p>key 3 </p> <p>key 4</p> <p>key5 </p> <p>Checked </p> <p>created on</p> <p>The only fields I want to really allow people to edit is the Name and Text </p> <p>so on my edit_guides.php</p> <pre><code>$id = $_GET['id']; $guides = mysql_escape_string(mysql_query("SELECT * FROM guides WHERE id = '$id'")); </code></pre> <p>Im a little unsure on this one being correct? </p> <p>Do I not need View or anything???</p> <p>Then for the form:</p> <pre><code> ECHO &lt;&lt;&lt;END &lt;center&gt; &lt;FORM ACTION="edit_guide.pro.phpid=$id" enctype="multipart/form-data" METHOD=POST&gt; &lt;table width="446" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td colspan="2"&gt;&lt;center&gt;Edit a Guide&lt;/center&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="79"&gt;Made By:&lt;/td&gt; &lt;td width="367"&gt;&lt;input type="text" name="madeby" value="$guides[username]"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Name of Guide:&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="name" value="$guides[name]"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Filed Under:&lt;/td&gt; &lt;td&gt;&lt;select name=filedunder&gt; &lt;option value=guides&gt;Guides &lt;option value=dailies&gt;Dailies Guides &lt;option value=gg#h&gt;Game Guides # - H &lt;option value=ggiq&gt;Game Guides I - Q &lt;option value=ggrz&gt;Game Guides R - Z &lt;option value=helpfulguides&gt;Helpful Guides &lt;option value=newbie&gt;Newbie Guides &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;Content:&lt;/td&gt; &lt;td&gt;&lt;textarea name="coding" cols="50" rows="35" value=""&gt;$guides[coding]&lt;/textarea&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Key Word 1&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="key1" value="None"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Key Word 2&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="key2" value="None"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Key Word 3&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="key3" value="None"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Key Word 4&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="key4" value="None"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Key Word 5&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="key5" value="None"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2"&gt;&lt;center&gt;&lt;font size="-1"&gt;&lt;i&gt; &lt;input type=submit name=Submit value="Edit"&gt; &lt;/i&gt;&lt;/font&gt;&lt;/center&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/FORM&gt; </code></pre> <p>However this shows on the page:</p> <p>Made By: R</p> <p>Name of Guide: R </p> <p>Filed Under: Default (guides)</p> <p>Content: R</p> <p>Then my edit_guides.pro.php Though Im still unsure if this page works, As Im just not getting that far yet.</p> <pre><code> $id=$_GET['id']; $madeby = $_POST['madeby']; $name = $_POST['name']; $coding = $_POST['coding']; $key1 = $_POST['key1']; $key2 = $_POST['key2']; $key3 = $_POST['key3']; $key4 = $_POST['key4']; $key5 = $_POST['key5']; $filedunder = 'guides'; $filedunder2 = $_POST['filedunder']; if ((!$madeby) OR (!$name) OR (!$coding) OR (!$filedunder2) OR (!$key1) OR (!$key2) OR (!$key3) OR (!$key4) OR (!$key5)) { die(header("Location: $baseurl/staff/edit_guides.php?id=$id&amp;error=Please+do+not+leave+any+info+blank.")); } else { mysql_query("UPDATE guides SET name = '$name' WHERE id = '$id'"); mysql_query("UPDATE guides SET fileunder = '$filedunder2' WHERE id = '$id'"); mysql_query("UPDATE guides SET coding = '$coding' WHERE id = '$id'"); mysql_query("UPDATE guides SET key1 = '$key1' WHERE id = '$id'"); mysql_query("UPDATE guides SET key2 = '$key2' WHERE id = '$id'"); mysql_query("UPDATE guides SET key3 = '$key3' WHERE id = '$id'"); mysql_query("UPDATE guides SET key4 = '$key4' WHERE id = '$id'"); mysql_query("UPDATE guides SET key5 = '$key5' WHERE id = '$id'"); header("Location: $baseurl/staff/index1.php?error=The+news+has+been+updated+:)"); </code></pre> <p>The main Issue Im having right now, Is its not showing the content (text) or anything from database only the letter R which means nothing to me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload