PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
print ("something!");
$link = mysqli_connect("localhost","xxx","yyy","testDB");
if(mysqli_connect_errno())
{
printf("Connection failed: %s\n", mysqli_connect_error());
exit();
}
else
{
$sql = "insert into testtbl(firstName) values('christine')";
$result = mysqli_query($link, $sql);
if($result == TRUE)
{
echo "a record has been inserted.";
}
else
{
printf("Could not insert record: %s\n",mysqli_error($link));
}
mysqli_close($link);
}
?>
The first line of code, "print ("something!");" is outputing to the browser which tells me php is working correctly with apache. However the rest of the code seems to be doing nothing. I am not sure if its making a connection or not. Anyone please assist.
~pickle | Please use [ syntax ] or [ code ] tags where appropriate. Your post has been modified. I also removed your database credentials.
Everah | Please use [code] tags when posting code in the forums. For posting PHP code, use [code=php]. Thanks.
Below is the code I tried and it still did not work