#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Finland, Hanko
    Posts
    17
    Rep Power
    0
    I have a problem in mysql_query = "select min(id) from users". It returns "2" in php script and in mysql console it return it right ("1").
    Can somebody explain what in doing wrong.
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    It returns "2" in php script and in mysql console it return it right ("1").
    >>

    Your syntax is right..

    can you post that script here?..so we can see how you are doing this..

    try that with following example:

    $con=mysql_connect('localhost','username','passsword');
    //connection string

    mysql_select_db('yourdatabase',$con);
    //select your database.

    $result=mysql_query("select min(id) as a from users",$con);
    //issue a query

    $row=mysql_fecth_array($result);

    //get the values ..

    if($result){
    echo "minimum :".$row["a"];
    //print minimum value..
    }else{
    echo "No resultn";
    exit;
    }

    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."


    [This message has been edited by Shiju Rajan (edited July 20, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Finland, Hanko
    Posts
    17
    Rep Power
    0
    The script is like this:
    mysql_connect('localhost', 'root' , 'passwd');
    mysql_select_db('cle');

    //querys
    $min = mysql_query("select min(id) from users");
    $max = mysql_query("select max(id) from henkilo");

    "Funniest" thing is that the $max -function i s working right but $min isnīt ???

    I tried your script, and it returned right "1" , so my problem is now solved , but I still canīt figure out why it returned
    Thanx alot =)


Similar Threads

  1. emailing 6,000 users
    By artybug in forum PHP Development
    Replies: 0
    Last Post: January 30th, 2004, 09:54 AM
  2. Replies: 0
    Last Post: January 27th, 2004, 11:16 AM
  3. select verification onsubmit
    By DrStein in forum HTML Programming
    Replies: 3
    Last Post: January 20th, 2004, 04:16 AM
  4. displaying mysql result in a select box
    By notaloser in forum PHP Development
    Replies: 4
    Last Post: January 13th, 2004, 06:30 PM
  5. select distinct problem
    By mrengc in forum MS SQL Development
    Replies: 1
    Last Post: December 23rd, 2003, 08:50 AM

IMN logo majestic logo threadwatch logo seochat tools logo