I am having some difficulties using the PHP insert into statement to add a new row to a MYSQL Table. I have granted all privileges to the remote user and I have been able to view to table fine. However, when I try to insert into the table I also get A NULL return. Any suggestions?
Here is the code:
<?php
$ID1=$_REQUEST["ID1"];
$ID2=$_REQUEST["ID2"];
$ID3=$_REQUEST["ID3"];
$ID4=$_REQUEST["ID4"];
$ID5=$_REQUEST["ID5"];
$return = "0";
$link = mysql_connect('my-remote-server', 'root', 'pwd');
if (!$link) {echo $return; $end ="1";}
$db_selected = mysql_select_db($ID3, $link);
if (!$db_selected) {echo $return; $end ="1";}
if ($end != "1")
{
if (($ID5 == "1") && ($ID4 == "%%%"))
{
$check = mysqli_query($link,"INSERT INTO Students (NetID, GroupID)
VALUES ('%s', '%s')",
mysql_real_escape_string($ID1),
mysql_real_escape_string($ID2));
echo var_dump($check);
echo "1";
}
}
sprintfsomewhere? (Go for real prepared statements though).