php - How do I show this mysql error on screen -
The current function to run mysql query in PHP and error on the screen is when I have it only with query and error message session Trying to show a user $ _ session ['auto_id'] == 1
and regular users will just see a good message saying that there is an error
In the second example I tried to do this, but I'm not sure that the right inside code By parsing or die ( "")
Works:
& lt ;? PHP function editable ($ sql) {$ result = mysql_query ($ sql) or die ("& span style = 'font-SIZE: 11px; font-color: # 000000; font-family = Tahoma;' gt; Lt; center & gt; has an internal error. Please error@friendproject.com< br & gt; & lt; br & gt; "$ sql." & Lt; br & gt; & lt; br & gt; Mysql_error (error). '' & Lt; / center & gt; & lt; / fONT & gt; "); Return result;}?
does not work:
& lt ;? PHP function execution ($ sql) {$ result = mysql_query ($ sql) or die ("& style; style = 'font-size: 11px; font- Color: # 000000; font-family = tarah; 'gt; & lt; center & gt; Error occurred. The error has been entered & lt; br> & lt; / center & gt; & lt; br & gt; if ($ _ session ['auto_id'] == 1) {echo = ' & Lt; br & gt; '$ sql.' & Lt; br & gt; & lt; br & gt; Mysql_error (). "}") ;; & Gt;
A string browser passed to die and any PHP code inside it Will be considered as a literal string and will not be interpreted. Maybe you want something else like this:
center An error has occurred, the error has been entered & lt; br & gt; & lt; / center & gt; & lt; / FONT & gt; "; If ($ _ session ['auto_id'] == 1) {// to add mysql error to string we are about output $ error = '& lt; Br> $ Sql '& Lt; Br> & Lt; Br> . Mysql_error ();} die ($ error);} return result;}
Comments
Post a Comment