MySQL Forums
Forum List  »  PHP

Re: PDO::query
Posted by: Rimma Bogdanova
Date: October 06, 2018 02:24AM

Now I have a new code, but reseive : "Parse error: syntax error, unexpected ')' in C:\Server\htdocs\www\example.php on line 27".
What is wrong here?

<html>
<head>
<link href="../../css/phpMM.css" rel="stylesheet" type="text/css" />
</head>
<body>

<?php
$mysqli = new mysqli('127.0.0.1', 'nativeuser', '123', 'publications');
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();}
if ($result = $mysqli->query("SELECT DATABASE()")) {
$row = $result->fetch_row();
$result->close();}
$mysqli->select_db("publications");
if ($result = $mysqli->query("SELECT DATABASE()")) {
$row = $result->fetch_row();
printf("Default database is %s.\n", $row[0]);
$result->close();}
$mysqli->close();
?>
<?php
function getclassics($conn) {
$sql = 'SELECT author FROM classics';
$result = $conn->query($sql) or exit( mysqli_error($conn) );
foreach( $row=mysqli_fetch_row($res) ) as $row) {
print $row['author'] . "\t";
}}
?>
</body>
</html>

Options: ReplyQuote


Subject
Written By
Posted
October 05, 2018 10:16AM
October 05, 2018 11:59AM
Re: PDO::query
October 06, 2018 02:24AM
October 06, 2018 08:49AM
October 06, 2018 12:27PM
October 06, 2018 02:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.