Jump to content

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


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

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.