Note that there are some explanatory texts on larger screens.

plurals
  1. POCan you see a logic error
    primarykey
    data
    text
    <p>I have this script:</p> <pre><code>&lt;?php /** * The template for displaying all pages. * Template Name: modify.php * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages * and that other 'pages' on your WordPress site will use a * different template. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?&gt; &lt;div id="primary" class="site-content"&gt; &lt;div id="content" role="main"&gt; &lt;?php while ( have_posts() ) : the_post(); ?&gt; &lt;?php get_template_part( 'content', 'page' ); ?&gt; &lt;?php comments_template( '', true ); ?&gt; &lt;?php endwhile; // end of the loop. ?&gt; &lt;?php $user_id = get_current_user_id(); if($user_id==0) { echo "Login please"; exit; } mysql_connect("localhost", "", "") or die (mysql_error()); #echo "Connected to MYSQL "; mysql_select_db("derp") or die (mysql_error()); #echo "Connected to Data Base"; /*$query = "SELECT * FROM addserverame WHERE userId='{$user_id}'"; $result = mysql_query ($query) or die (mysql_error());*/ if(!isset($_POST['submit'])) { $q = "SELECT * FROM addserverame WHERE ID = $_GET[id] AND userId='{$user_id}'"; $result = mysql_query ($q); $person = mysql_fetch_array ($result); } ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;Add Your Server&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="view.css" media="all"&gt; &lt;script type="text/javascript" src="view.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body id="main_body" &gt; &lt;img id="top" src="top.png" alt=""&gt; &lt;div id="form_container"&gt; &lt;h1&gt;&lt;a&gt;Modify Server&lt;/a&gt;&lt;/h1&gt; &lt;form id="form_606591" class="appnitro" method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt; &lt;div class="form_description"&gt; &lt;h2&gt;Add Your Server&lt;/h2&gt; &lt;p&gt;&lt;/p&gt; &lt;/div&gt; &lt;ul &gt; &lt;li id="li_1" &gt; &lt;label class="description" for="servername"&gt;Server Name &lt;/label&gt; &lt;div&gt; &lt;input id="element_1" name="Servername" class="element text medium" type="text" maxlength="255" value="&lt;?php echo $person['servername']; ?&gt;"/&gt; &lt;/div&gt;&lt;p class="guidelines" id="guide_1"&gt;&lt;small&gt;Enter your server name here NOT your server address.&lt;/small&gt;&lt;/p&gt; &lt;/li&gt; &lt;li id="li_2" &gt; &lt;label class="description" for="Serveraddress"&gt;Server Address &lt;/label&gt; &lt;div&gt; &lt;input id="element_2" name="Serveraddress" class="element text medium" type="text" maxlength="255" value="&lt;?php echo $person['serveraddress']; ?&gt;"/&gt; &lt;/div&gt;&lt;p class="guidelines" id="guide_2"&gt;&lt;small&gt;This will the DNS name of your server&lt;/small&gt;&lt;/p&gt; &lt;/li&gt; &lt;li id="li_3" &gt; &lt;label class="description" for="Portnumber"&gt;PortNumber &lt;/label&gt; &lt;div&gt; &lt;input id="element_3" name="Portnumber" class="element text medium" type="text" maxlength="255" value="&lt;?php echo $person['portnumber']; ?&gt;"/&gt; &lt;/div&gt;&lt;p class="guidelines" id="guide_3"&gt;&lt;small&gt;This will be the port your server is using.&lt;/small&gt;&lt;/p&gt; &lt;/li&gt; &lt;li id="li_4" &gt; &lt;label class="description" for="Description"&gt;Server Description &lt;/label&gt; &lt;div&gt; &lt;textarea id="element_4" name="Description" class="element textarea medium" value ="&lt;?php echo $person['description']; ?&gt;"&gt;&lt;/textarea&gt; &lt;/div&gt;&lt;p class="guidelines" id="guide_4"&gt;&lt;small&gt;Enter server description/rules here.&lt;/small&gt;&lt;/p&gt; &lt;/li&gt; &lt;li class="buttons"&gt; &lt;input type="hidden" name="id" value="&lt;?php echo $_GET['id']; ?&gt;" /&gt; &lt;input id="saveForm" class="button_text" type="submit" name="submit" value="Modify" /&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/form&gt; &lt;div id="footer"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt;- &lt;/html&gt; &lt;? if(isset($_POST['submit'])) { $u = "UPDATE addserverame SET `servername`='$_POST[Servername]', `serveraddress`='$_POST[Serveraddress]', `portnumber`='$_POST[Portnumber]', `description`='$_POST[Description]' WHERE ID = $_POST[id] AND userId='{$user_id}'"; mysql_query($u) or die (mysql_error()); echo "Server Info Has Been Modified"; } ?&gt; &lt;/div&gt;&lt;!-- #primary --&gt; &lt;/div&gt;&lt;!-- Content --&gt; &lt;?php //endif; ?&gt; &lt;?php get_footer(); ?&gt; </code></pre> <p>I cant figure what, if any what the logical errors are.</p> <p><strong>Whats meant to happen</strong> the user chooses to update a table if the table is theirs they should be able to edit it and update the table.</p> <p><strong>Whats happening</strong> the user will try and edit it but it will not update there is no successful modify echo and they are redirected to the front page.</p> <p>Can any one in all there wisdom explain to me why this is happening instead of what i want to happen.</p> <p>Thanks</p> <p>Ben</p>
    singulars
    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.
 

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