マシン上の MySQL データベースにアクセスしようとしています。ポート1338にあります。
これは PHP ファイルです。
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<table>
<?php
$connection = mysql_connect("localhost:1338","root","password"); //connects to db
$selected = mysql_select_db("site_updatelog"); //selects the db to be used
//Check whether connection was successful
if(!$connection){
die('Could not connect to database: ' . mysql_error()); //Stop further execution of php script and show the error that occured
}
$sql = "SELECT comments, version, datetime FROM changeLog ORDER BY id DESC"; //form the query to be executed on the db
$result = mysql_query($sql, $connections) or die (mysql_error()); //execute the query, or die if there was an error
while($row = mysql_fetch_array($result)){
//Display the table of results
echo "<tr><td>". $row['version'] ."</td><td>". $row['comments'] ."</td><td>". $row['datetime'] ."</td></tr>";
}
mysql_close($connection);
?>
</table>
</body>
</html>
これは出力です:
"; } mysql_close($connection); ?>
". $row['version'] ." ". $row['comments'] ." ". $row['datetime'] ."
かなり長い間いじっていますが、まだ機能しません。何か案は?