Jump to content

[SOLVED] mysql_real_escape_string not working?


lokie538

Recommended Posts

Hi,

 

Im trying to impliment this mysql_real_escape_string into my code :/ not hard I thought, but some some reason it just wont work? Probably something simple im doing?

 

This is the important bits of the code!

 

<?php
// connect to the database
$cxn = mysqli_connect($host,$user,$passwd,$dbname) 
            or die ( "Location: error.html" ); 	

$picid = $_POST['picid'];
$comment = $_POST['comment'];
$name = mysql_real_escape_string($_POST['name']);   //// this bit is not working?? Doesnt store anything in the database? works if i get rid of mysql_real_escape_string(
$email = mysql_real_escape_string($_POST['email']);

echo $picid;
echo $comment;
$comment = nl2br($comment);
echo $_POST['comment'];
echo "<br>";
echo $comment;

$dt2 = date('Y-m-d H:i:s');
echo $dt2;

$query = "INSERT INTO `1300blablabla`.`piccomments` (
`picid` ,
`comment` ,
`name` ,
`email` ,
`date`
)
VALUES (
'" . $picid . "', '" . $comment . "', '" . $name . "', '" . $email . "', '" . $dt2 . "'
)";

$result = mysqli_query($cxn,$query) or die ("Couldnt execute queryLOLHEAPS FUCKING CUT.");
mysql_error();

echo $comment;

$stat = "sucess";
header ( "Location: gallery.php?stat=". $stat . "&picid=" . $picid . "" );
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.