Jump to content

mysql_fetch_array(): supplied argument is not a valid MySQL result resource?


marts555

Recommended Posts

Hello!

I'm kinda new to PHP so excuse me for bothering you all with such a newbie-like question and code...

Well you'll understand what i want with this code so i wont bother you about explaining it but i wonder why do i get "mysql_fetch_array(): supplied argument is not a valid MySQL result resource" error when i try to open it with a browser.

This is the code:

  <?php

  $d = date('Y.m.d');

  echo $d;

  $con = mysql_connect("localhost","root","");

if (!$con)

  {

die('Could not connect: ' . mysql_error());

  }

    mysql_select_db("skolnieki",$con);

$query="SELECT DISTINCT skolnieki WHERE date=$d";

$result=mysql_query($query,$con);

    while($row = mysql_fetch_array($result))

  {

echo $row['name'];

echo "<br>";

}

  ?>

 

So can anyone explain what is wrong with this code since i don't see the problem but WAMP 2.0 says the error? ^^

And yes i've made sure that MySQL DB has the same date in it - "2009.06.04" i believe it is as text but then again i inserted it using MySQL consol from .txt file made in MExcel so i just guess it is as text.

Just in case - there is a "name" column with a name XD

 

Thanks,

Marts555

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.