Jump to content

mysql_query(): supplied argument is not a valid MySQL-Link resource..


damnedgentleman

Recommended Posts

Hi everyone.

 

I confess, I've been learning PHP now for a very short amount of time and really enjoy using it!  However, I do seem to be having a spot of bother using it in conjunction with MySQL.  So far all I've managed to do is get a couple of table creation scripts to work.

 

I've spent today trying to get the following code to function but I'm not having much luck.  Running the script returns the error message:

 

"Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/blah/blah/php/displayEvents.php on line 19"

 

Can anybody tell me where I've gone wrong?

 


<?php

//database connection information.
include ("dbConnect.php");

//MySQL query assigned to variable.  Selects data from the events table for
//up and coming events.
$queryTable = "SELECT eventDate, eventName, eventDescLong, eventEntryFee 
FROM eventsTable 
WHERE eventDate >= CURDATE() AND eventDate <= DATE_ADD(CURDATE(), INTERVAL 7 DAY) 
ORDER BY EventDate ASC";

$result = mysql_query($connection, $queryTable)
  or die (mysql_error());

//Pulls data from events table and assigns it to an array.
while($row = mysql_fetch_array($result)) {

  //Assigns table fields from array to variables.
  $eventDate = $row ['eventDate'];
  $eventName = $row ['eventName'];
  $eventDescLong = $row ['eventDescLong'];
  $eventEntryFee = $row ['eventEntryFee'];

  //displays event information.

  echo "<h1>$eventArtists</h1>";
  echo "<h2>$eventDate Tax: &pound$eventEntryFee</h2>"; 
  echo "<p>$eventDescLong</p><br>";

  }

mysql_close ($connection);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.