#1
  1. No Profile Picture
    Matt_Gamersgateway.com
    Guest
    Devshed Newbie (0 - 499 posts)
    I'm not entirely new to MySQL... but I'm have problems trying to use the "where blah = '$blah'." I would appriciate any help. Here is a snip of my code, what is wrong!?!!
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    db_connect();
    $result = mysql_query("select userid,username,password,email,level,misc FROM user where 1 and username like '$name' and password like '$userpassword' LIMIT 0, 2") or error_message('You have not been verified');
    $query_data = mysql_fetch_row($result);
    if ('$userpassword' != '$query_data[2]') {
    error_message('You Do Not Have Access To The News Updater');
    exit;
    }
    mysql_close();
    [/quote]

    [This message has been edited by Matt_Gamersgateway.com (edited 10-31-99).]
  2. #2
  3. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    First what is this:

    "where 1 and.."?

    why do you have that? It's not necessary.

    Let me show you how I'd write that and you can try it.

    $result=mysql_query("select userid,username,password,email,level,misc from user where username='$name' and password='$userpassword'");
    if (!$result)
    {
    // error message here
    }

    HTH
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    2
    Rep Power
    0
    Matt, I came across this old topic of yours and I am curious too about the 'WHERE 1 AND...' clause. I noticed Mysqladmin uses the same technique, and it seems to really speed up my queries (something about specifying which index to use?), but I really have no idea what it does. Do you know?

    Thanks,
    Denzel

Similar Threads

  1. match relevancy in mysql queries
    By naiad in forum MySQL Help
    Replies: 3
    Last Post: March 7th, 2004, 05:43 PM
  2. Coping with long/slow mysql queries.
    By siliconjunkie in forum PHP Development
    Replies: 4
    Last Post: February 17th, 2004, 03:03 PM
  3. multiple mysql queries
    By Paul Knapp in forum MySQL Help
    Replies: 3
    Last Post: February 12th, 2004, 07:13 AM
  4. tracking all mysql queries
    By hucker in forum MySQL Help
    Replies: 0
    Last Post: February 5th, 2004, 11:27 AM

IMN logo majestic logo threadwatch logo seochat tools logo