#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    15
    I get "Not a valid MySql Resource on line bla bla (line were the result is evaled)of filebla". My SQL query is correct. I've tried both ways of connecting to mysql (using select db and mysql_query instead of mysql_db_query)

    $id_link = mysql_connect('localhost','username','password');
    $db = "boham";
    $sql = "select * from testaffiliate where username = '$PHP_AUTH_USER' and password = '$PHP_AUTH_PW'";
    $result = mysql_db_query($db,$sql,$id_link) | | die("Cannot execute SQl query");
    if ($row = mysql_fetch_array($result))

    any help or ideas would be greatly appreciated!!

    -Jerome
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    15
    Anybody? I'm sooooo stuck!!!!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Pune, Maharashtra, India
    Posts
    86
    Rep Power
    15
    Try maybe something like this:
    #Connecting to the database
    $db=mysql_connect($host,$username,$password) or Die("Unable to connect to the database, Please try later");
    mysql_select_db($database,$db,$password) or die("Unable to Select Database, Please try later");
    $sql="select * from testaffiliate where username = '$PHP_AUTH_USER' and password = '$PHP_AUTH_PW'";
    $result=mysql_query($sql);
    while($row=mysql_fetch_array($result))
    {
    }


    ------------------
    Nikunj
    MYSQL/PHP/XML
    ** Expertise comes with experiece ** Nikunj

    [This message has been edited by nikunj (edited September 04, 2000).]
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    15
    I still get the same error. What can it be? I am soooo completely stuck. (if it helps, I'm using PHP-4)
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Herne Bay, Kent, UK
    Posts
    30
    Rep Power
    15
    I *think* it might be because you're not assigning the result of mysql_select_db() to a variable, even if you don't then use it...

    $database_server=mysql_connect("server","user", "pass");

    $database=mysql_select_db("dbase",$database_server);

    $results=mysql_query($sql,$database_server);

    works for me.

Similar Threads

  1. Flash in apache - wont work!
    By Fish_12345 in forum Apache Development
    Replies: 2
    Last Post: October 11th, 2004, 02:43 PM
  2. php script won't work inside "cgi-local" directory
    By Volitics in forum PHP Development
    Replies: 5
    Last Post: April 26th, 2004, 11:50 PM
  3. Experienced undergrad senior ... freelance work wanted
    By carrja99 in forum Hire A Programmer
    Replies: 0
    Last Post: January 29th, 2004, 12:32 AM
  4. I'll pay someone $150 to do some PHP work for me!
    By Noah Neiman in forum Hire A Programmer
    Replies: 16
    Last Post: January 23rd, 2004, 04:15 AM
  5. I need some specific php work done for my website
    By Noah Neiman in forum Hire A Programmer
    Replies: 1
    Last Post: January 21st, 2004, 12:31 AM

IMN logo majestic logo threadwatch logo seochat tools logo