Jump to content

Warning: mysql_fetch_array


BioStatic

Recommended Posts

Here is what I am getting when I installed something, I don't quite understand.. Can someone please help me out? I have my MySQL username, pass and database name setup in the config.php file, so I'm not quite sure what I am doing wrong here..

 

Here is the (website)

 

http://www.canadianguy.net/images/index.php

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/canadid0/public_html/images/index.php on line 21 Top Ten

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/canadid0/public_html/images/inc/function.php on line 11

 

the index.php on line 21 I get

 

while($r = mysql_fetch_array($q))

 

 

 

Link to comment
Share on other sites

Oh great, thanks a lot :)

 

 

<html>

<head>

<title>Hotwebtools.com - Rating System Script</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="css/index.css" rel="stylesheet" type="text/css">

</head>

 

<body>

<div align="center">

<?php

/*  This script is developed by David Ausman Hotwebtools.com

You may use or redistribute it freely as long as you retain

my copyright and does not resell it. Please respect

my time & effort implemented on this project. Enjoy :)

*/

include 'inc/config.php';

include 'inc/conn.php';

if(empty($cid))

{

$q = mysql_query("select min(id) from image");

while($r = mysql_fetch_array($q))

Link to comment
Share on other sites

The error is implying that your actual query isn't valid.  Which is this:

 

select min(id) from image

 

Although it looks valid to me, try changing this line:

 

$q = mysql_query("select min(id) from image");

 

to this:

 

$q = mysql_query("select min(id) from image") or die(mysql_error());

Link to comment
Share on other sites

See this code here?

 

$conn = mysql_connect($host, $username, $password);
mysql_select_db($db);
?>

 

What is in '$db'?  You never assign a value to '$db' so how is mysql_select_db suppose to know what database to select?  Same with the parameters in mysql_connect, I fail to see where you assign those values as well.  I'm not sure why you didn't receive errors for that first.

Link to comment
Share on other sites

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.