Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Saturday, January 19, 2008

mysqli

http://devzone.zend.com/node/view/id/686

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

PHP mysql quick reference


$mysqli = new mysqli($host, $login, $pw, $database);
if ($result = $mysqli->query('SELECT name from employee'))
{
while( $row = $result->fetch_assoc() ){
echo "".$row['name']."
";
}
/* Destroy the result set and free the memory used for it */
$result->close();
}

/* Close the connection */
$mysqli->close();
?>