Saturday, January 19, 2008

php myql quick reference2

$stmt = $mysqli->prepare("SELECT id, thetime, towho, fromwho, message, style FROM chat where towho = ? order by id LIMIT " . intval($_POST[o]) . "," . $rowstoget);// . intval($rowstoget));
$stmt->bind_param('s', $to1);


$stmt->execute();

/* bind variables to prepared statement */
$stmt->bind_result($id, $thetime, $towho, $fromwho, $message, $style);


/* fetch values */
while ($stmt->fetch()) {


$badchar = array("\\","'","\r\n","\r","\n");



$replacebadchar = array("\\\\","\\'","
","
","
");



$fromwho = str_replace($badchar,$replacebadchar,$fromwho);
$towho = str_replace($badchar,$replacebadchar,$towho);
$message = str_replace($badchar,$replacebadchar,$message);
$style = str_replace($badchar,$replacebadchar,$style);//"color: \'rgb(0,128,0)\'"; //str_replace($badchar,$replacebadchar,$style);
...

No comments: