Note that there are some explanatory texts on larger screens.

plurals
  1. POIf I have php in database can I use that?
    primarykey
    data
    text
    <p>If I have php within my database can I use that. Specifically I have<code>&lt;?php echo $email; ?&gt;</code> with a column called content. On a protected page called user I call on the content column and spit out a page. Similar to a blog would within a while mysqli. When I look into my database though I see the function is actually the full <code>&lt;?php echo $email; ?&gt;</code> rather than the actual variable that was posted with a form.</p> <p>Edit:</p> <p>Also I'm looking within firebug to see what shows up for value within the form and it is indeed the full echo statement. The echo statement is pulled from the database as part of a stored form. Is this not good practice? If so how can this be done? Am I missing something??</p> <p>Further info is that I am using mysqli escape string to input the data..</p> <p>I've got a script that echos out the content for the page. In this case the content from the database is a form which includes a hidden field for email. This way I can tell whos posting to the database so that we can establish a connection.</p> <p>Within the original page are active variables that are included on this particular page. I'm including in the form from the database a field like so:</p> <pre><code>&lt;input type="hidden" id="email" value="&lt;?php echo $email; ?&gt;" /&gt; </code></pre> <p>Normally the echo would work, but I'm not sure why its not. That is why I ask if the fact that that input field is coming from the database has any bearing on it not echoing based on the variables already located within the page?</p> <p>Further example for explanation:</p> <pre><code>&lt;?php include_once "includes/db_conx.php"; $sql = "SELECT * FROM course ORDER BY id DESC"; $sql_page = mysqli_query($db_conx,$sql); while($row = mysqli_fetch_array($sql_page)){ $email = $row["email"]; } ?&gt; </code></pre> <p>Thats the email on the actual user.php page.....</p> <p>Now the user.php also has an area for content..</p> <pre><code>&lt;?php include_once "includes/db_conx.php"; $sql = "SELECT * FROM content ORDER BY id DESC LIMIT 1"; $sql_page = mysqli_query($db_conx,$sql); while($row = mysqli_fetch_array($sql_page)){ $content = $row["content"]; } ?&gt; </code></pre> <p>We'll say that the content looks like this...</p> <pre><code> &lt;form&gt; &lt;input type="hidden" id="email" value="&lt;?php echo $email; ?&gt;" /&gt; // &lt;/form&gt; </code></pre> <p>This also outputs on user.php notice that user.php does have $email....how are you saying to approach this? How else can I echo this?</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.
 

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