php - Can't insert links to DB -
i have code:
if (!empty($_post['w1']) && !empty($_post['l1'])) { $str = "<a href='".$_post['l1']."'>".$_post['w1']."</a>"; $content = str_replace($_post['w1'],$str, $content); } $content = nl2br($content); echo "נוסף"; echo $content; mysql_query("insert `posts` values ('','".$_post['subject']."','$content','0')");
the php page doesn't return error. data isn't inserted db. know problem?
if there mysql error thrown, not shown you. following see error:
mysql_query("insert `posts` values ('','". mysql_real_escape_string($_post['subject']) . "','" . mysql_real_escape_string($content) . "','0')") or die mysql_error();
be aware of sql-injections!
Comments
Post a Comment