Note that there are some explanatory texts on larger screens.

plurals
  1. POFlexibility within 'Print/Echo'
    primarykey
    data
    text
    <p>I made this code:</p> <pre><code>&lt;?php if($this-&gt;session-&gt;userdata('login_user_id')); $a = $this-&gt;session-&gt;userdata('login_user_id'); $b = mysql_query("SELECT * FROM user WHERE id='$a' AND specialrank='1'") or die(mysql_error()); while($c = mysql_fetch_array( $b )) { Print $c['username']; } ?&gt; </code></pre> <p>basically it creates a session for the logged in user. I want to be able to show more in the print section though, some advanced php code and html form. Is there a way I can do this by reworking the code? It seems I'm limited with regards to which characters I can use within the print statement. Basically, I want to display a form to specific users and not others. I have tried closing the <code>&lt;?php ?&gt;</code> tags after every line to see if that works but it throws up errors of unexpected and expected's etc.</p> <p>EDIT:</p> <p>this is the segment of code I want to show:</p> <pre><code>&lt;?php // update if(isset($_POST['update'])) { $id = $_POST['id']; $emp_salary = $_POST['emp_salary']; $sql = "UPDATE pins SET is_private = $emp_salary WHERE id = $pinDetails-&gt;id"; mysql_select_db('test_db');$retval = mysql_query( $sql );if(! $retval ) { die('Could not change: ' . mysql_error()); } echo "Post is now private&lt;br&gt;&lt;br&gt;"; } ?&gt; &lt;form method="post" action="&lt;?php $_PHP_SELF ?&gt;"&gt; &lt;table width="400" border="0" cellspacing="1" cellpadding="2"&gt; &lt;tr&gt; &lt;td&gt;Private &lt;input name="emp_salary" type="text" id="emp_salary" value="1"&gt; &lt;input name="id" type="hidden" id="id"&gt; &lt;input name="update" type="submit" id="update" value="Change"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>As you can see, simply putting that within the print throws up so many errors.</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.
    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