Jump to content
Goke

Customize mysql_error() message

Recommended Posts

Majoritatea site-urilor au genul asta de mesaj atunci cand sunt vulnerabile la sql

WARNING: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1''' at line 1

Insa altele , apar cu txt mare , frumos asezate intr-un tabel , cu un border rosu .. si mai sunt si alte genuri de asezare in pagina a erorii

am incercat si eu insa nu stiu cum sa fac sa apar precum sunt acele exemple de mai sus..

-am folosit :

<?php
$cn=mysql_connect("mysql.hostinger.ro","test","testTestos") or die(mysql_error());
mysql_select_db("test");
$Sql="select * from TestDeTestoasa where id='".$_GET['id']."'";
echo $Sql;
$rez=mysql_query($Sql);
$rand=mysql_fetch_array($rez);
if($rand!=false){
echo $rand['id'];
echo $rand['title']."<br>";
echo $rand['text']."<br>";
<!-------ACI` CRED CA TREBUIE SA SCHIMB CATE CEVA

}else
echo mysql_errno() . ' : ' . @Mysql_error() ;

PANA ACI`-----------!>
?>

Insa vreau ca de ex eroarea sa apara tot intr-un border

eroarea mea :

select * from TestDeTestoasa where id='1''1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1''' at line 1

Inca ceva , de ce apare si aceasta chestie si cum o pot scoate din pagina.

select * from TestDeTestoasa where id='1''
Link to comment
Share on other sites

iti apare

select * from TestDeTestoasa where id='1''
deoarece ai un echo $Sql;

iar pentru border trebuie sa dai echo si la niste html, astfel:

echo "<h1 style='border:2px black solid; font-size:18px;'> " . mysql_errno() . ' : ' . Mysql_error() . '</h1>';
Edited by BGS
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...