Note that there are some explanatory texts on larger screens.

plurals
  1. POError Function That Store Errors In a Database
    text
    copied!<p>i have this function that i use to handle my errors<br> within php query and things like that </p> <p>but i thought it will be better that if i can save the errors in the database then show it up in my admin control panel, so no one can see the errors that i have on my website </p> <p>here is the function :</p> <pre><code>function er($str) { global $db; if (!$str) { $errornum = $db-&gt;errorinfo(); echo $errornum[2]; die; } } </code></pre> <p>and here i was trying to do what i said i want to do :</p> <pre><code>function er($str) { global $db; if (!$str) { $errornum = $db-&gt;errorinfo(); $en = $errornum[2]; echo "".$en.""; $db-&gt;query("INSERT INTO `error` (`con`) VALUES ('$en')"); die; } } </code></pre> <hr> <pre><code>The Problem Is : </code></pre> <blockquote> <p>that the query dosent do anything </p> </blockquote> <pre><code>The Reason Is : </code></pre> <blockquote> <p>i believe that the reason is that $en is empty ... so the insert wont do anything as it dosent have a name to insert it into the database , but $en isnt empty as when i echo it i dose output the error .. i fugure that out while i was trying to get it work i replaced $en with (Example) and it worked and (Example) was there in the database</p> </blockquote> <pre><code>Fix : </code></pre> <blockquote> <p>I'm not sure but i think if i can get it to paste the real value of the $en .. then it will be working :D</p> <p>But i need you to help me to do it or point me to the right direction</p> </blockquote>
 

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