MySQL Error

apps

#1

I have been getting the following mysql error for awhile now on my new domain. I created a new mysql subdomain on the new domain just recently (maybe that is causing the problem?). Anyways, all I am doing is connecting to the database, which does not return an error and then trying to run an simple select query. I have managed to get basically the same script up and working on my other domain. Any suggestions? Thanks.

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


#2

It may be useful if you are able to paste up some of the script and query details that you are using. Someone may then see if there are any problems.

You can mask out any private information.


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK!! :@

You act on my advice at your own risk!


#3

Okay, I should have done that in the first place.

Here is the header of the page:

<?php include("config.php"); function displayArticle() { if($_GET['id']) { $id = $_GET['id']; $q = "SELECT * FROM article WHERE ar_id ='$id'"; $result = mysql_query($q,$conn); //$content = "

".$result['ar_title']."

"; //echo $content; } else { echo "No id entered."; } } ?>

Later in the page I have: <?php displayArticle(); ?>

My config.php is the following (all login stuff removed)

<?php $host=""; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name=""; // Database name // Connect to server and select databse. $conn = mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name", $conn)or die("cannot select DB"); ?>

When I run the script it does not give me errors in regards to connecting to the database (I purposely messed with the passwords to see if that was the case and it gave me the appropriate – we can not log in— message.)

Thanks.


#4

Nevermind, it seems that I am a fool. My friend pointed out that I forgot to use a mysql_fetch_ to grab the queried data.