Results 1 to 3 of 3

Thread: MySQL hates me. PHP ain't too fond either

  1. #1

    MySQL hates me. PHP ain't too fond either

    can anyone tell me what's wrong with the following code?
    Trying to get php to grab the posible values of group and make a nice <select>.
    Thing is I use (almost) the same code, on a different table in the same db and it works like a charm.
    Code:
    <?php
    
    //connect to db
    $conn = mysql_connect("localhost", "dbusr", "somepassword") or die("Invalid server or user");
    
    //select db
    mysql_select_db("roombook", $conn);
    
    $result=mysql_query("SELECT DISTINCT group FROM links", $conn);
    
    while ($myrow=mysql_fetch_array($result)) {
    
     * * *echo"<option value=\"".$myrow["group"]."\">".$myrow["group"]."</option>\n";
    
     * * *}
    
    
    ?>
    I get this error:
    supplied argument is not a valid MySQL result resource
    It craps out at the "while". I did a search for it but all I can find is sites who have this error in thier code.

    If I change the query to another field same table it works.

    Is the name "group" a restricted name or something?

  2. #2

    Re: MySQL hates me. PHP ain't too fond either

    never mind, it must be a restricted name.
    I changed the row name to intgroup and it works fine.


    --edit--
    It must be a PHP thing, as the query came back fine through myadmin, which was what confused me :

  3. #3
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Re: MySQL hates me. PHP ain't too fond either

    now see.................
    MySQL and PHP are not your enemies

    But Microsoft and other large corporations are

Similar Threads

  1. PHP Tutorial
    By Waka-Gashira in forum Windows - General Topics
    Replies: 8
    Last Post: 01-27-2005, 08:10 AM
  2. PHP on IIS Server
    By genesis in forum Windows - General Topics
    Replies: 8
    Last Post: 01-03-2005, 11:22 AM
  3. Apache, PHP, MySQL
    By vwgtiturbo in forum Linux - Software, Applications & Programming
    Replies: 8
    Last Post: 11-24-2003, 03:57 AM
  4. php / mysql
    By kornp in forum Linux - Hardware, Networking & Security
    Replies: 5
    Last Post: 05-07-2002, 02:25 PM
  5. mysql installation instructions & permissions
    By elovkoff in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 02-06-2002, 10:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •