+ 1
Is the following code is correct mysqli code ? I mean is it in pure sqli code ?
<html> <body bgcolor=#777 text=yellow> <form action=submit1.php method=post> <pre> id <input type=text name=id size=5> <br> User name <input type=text name=username> <br> <input type=submit> </pre> </form> </body> </html> <?php if($_SERVER["REQUEST_METHOD"]=="POST") { $id=$_POST['id']; $username=$_POST['username']; $con=mysqli_connect("localhost" , "root" , "" , "hassan"); // no space allowed b/w double quotes if(mysqli_connect_errno()) { echo "failed to connect to mysql" . my
8 Answers
0
so the code is in pure sqli code ??
+ 1
<html>
<body bgcolor=#777 text=yellow>
<form action=submit1.php method=post>
<pre>
id <input type=text name=id size=5> <br>
User name <input type=text name=username> <br>
<input type=submit>
</pre> </form> </body> </html>
<?php
if($_SERVER["REQUEST_METHOD"]=="POST") {
$id=$_POST['id'];
$username=$_POST['username'];
$con=mysqli_connect("localhost" , "root" , "" , "hassan"); // no space allowed b/w double quotes
if(mysqli_connect_errno()) {
echo "failed to connect to mysql" . mysqli_connect_error();
}
else {
mysqli_query($con , "INSERT INTO student (id , username ) VALUES ('$id' , '$username')");
echo "your record is added successfully <br>";
}
$con->close();
}
?>
0
jamie i really dnt know wat is playground . im new to solo learn .
if u hve whatsapp or fbook i can send the code there ...
0
mean the code is ok ???