Hi all - brand new to PHP and I'm getting the following errors:
Notice: Use of undefined constant link - assumed 'link' in D:\Program Files\EasyPHP-5.3.9\www\mysql.php on line 10
Notice: Use of undefined constant db_selected - assumed 'db_selected' in D:\Program Files\EasyPHP-5.3.9\www\mysql.php on line 17
What's strange is that the code works fine on my mac at home (WAMP) but not on this Windows 7 computer (Easy PHP).
The code looks like this:
<?php
include('mysql.php');
include('functions.php');
// Get one image based on lastVote date
$query="SELECT id, imageType, word FROM images ORDER BY lastVote LIMIT 0, 1";
$result = @mysql_query($query) or die('Error, query failed: ' . mysql_error());
while ($row = mysql_fetch_object($result)) {
$imageMain[] = (object) $row;
}
// Get other image randomly
$query="SELECT id, imageType, word FROM images WHERE id <> '" . $imageMain[0]->id . "' ORDER BY RAND( ) LIMIT 0 , 1";
$result = @mysql_query($query) or die('Error, query failed: ' . mysql_error());
while ($row = mysql_fetch_object($result)) {
$imageRandom[] = (object) $row;
}
// Close the connection
mysql_close();
?>
To clarify, line 10 is:
$imageMain[] = (object) $row;
and line 17 is:
while ($row = mysql_fetch_object($result)) {
Any ideas where I went wrong? Thanks so much.
-J