hi guys...when i insert some text in the database...
i get it like this:
r/n my texttttttt/r/n/
...
i tryedd to use:
$string = $mysqli->real_escape_string($string2);
and nothing happen :S...any help please ?
problem with mysqli r/n
Moderator: General Moderators
Re: problem with mysqli r/n
I don't see anything in that string that needs escaping, so I don't see a problem.
Re: problem with mysqli r/n
right..no need...but what with the r/n// ... i tryed to remove the escaping...i still get /r/n// ... and tryed to update...the same problem...no clean results :S....still with /r/n//
Re: problem with mysqli r/n
If you don't escape it and still get \r\n in your string then it's in your original string. That or you're manipulating it when pulling it from the database and printing it. Show us more of your code.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: problem with mysqli r/n
this is my code :
and this is the "echo":
Code: Select all
$sqlm = getPageById();
if ($resultm = $mysqli->prepare($sqlm))
{
$mypageid = 216;
$resultm -> bind_param("i",$mypageid);
$resultm->execute();
$resultm->store_result();
$rowsm = $resultm->num_rows;
}
if($rowsm > 0)
{
$rowm = fetch($resultm);
$pagetitle = $mysqli->real_escape_string($rowm[0]["page_title"]);
$pageContent = $rowm[0]["page_content"];
$pageurlname = $mysqli->real_escape_string($rowm[0]["page_name_url"]);
}Code: Select all
<?=$pageContent?>Re: problem with mysqli r/n
and this is my query:
Code: Select all
function getPageById()
{
$sqlStr = "select * from tbl_pages where page_id = ?";
return $sqlStr;
}Re: problem with mysqli r/n
and this is what i send in post:
Code: Select all
$mysqli->real_escape_string ($_POST["page_content"]);
Re: problem with mysqli r/n
ok thank u guys... i solved it
....
this is the solution:
i removed real_escape_string from $_POST["somename"];
....
and sure from the row.....in the row no need....
now when using a prepared statement in the query(insert,update,delete,select)...you do not need to use the real_escape_string in mysqli...because the prepared statement "makes the job"..
thank you every one

this is the solution:
i removed real_escape_string from $_POST["somename"];
....
and sure from the row.....in the row no need....
now when using a prepared statement in the query(insert,update,delete,select)...you do not need to use the real_escape_string in mysqli...because the prepared statement "makes the job"..
thank you every one