SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Whats wrong with these two lines?

    I get these errors:
    Warning: Wrong parameter count for mysql_query() in /home/httpd/vhosts/rutherfordrealestate.net/httpdocs/edit.php on line 31

    Warning: Wrong parameter count for mysql_result() in /home/httpd/vhosts/rutherfordrealestate.net/httpdocs/edit.php on line 36

    For these lines:
    $sqlQuery = "SELECT * FROM Users";
    $result = mysql_query($sqlQuery, 0, "Username");

    $accountlevel = mysql_query("SELECT Accountlevel FROM Users WHERE Username='$loggedid'");
    $accountid = mysql_result($accountlevel);
    echo "$accountid";
    Have a good day.

  2. #2
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://php.net/mysql_query
    resource mysql_query ( string query [, resource link_identifier] )
    You have '$result = mysql_query($sqlQuery, 0, "Username");' maybe you just mean:
    $result = mysql_query($sqlQuery);
    Though as you never use the results of that query the line is redundant.

  3. #3
    SitePoint Addict kivison's Avatar
    Join Date
    Dec 2004
    Location
    Whitley Bay, Tyne & Wear, UK
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forgive me but i am new ish myself...

    You can set up your variables from values stored in [$POST] by joining more onto the query

    I had a similar problem I think, and I built the query up from the following

    PHP Code:

    // The basic SELECT statement
    $select 'SELECT *';
    $from   ' FROM clients;
    $where  = ' 
    WHERE 1';
    $bywhat = ' 
    ORDER BY id';

    $Query = @mysql_query($select . $from . $where . $bywhat);
    if (!$Query) {
      
      exit('
    <p>Error retrieving clients from database!<br />'.
          '
    Error' . mysql_error() . '</p>');

    I might be all day wrong but I think I get the gist of your problem.

  4. #4
    SitePoint Guru defiance's Avatar
    Join Date
    Oct 2004
    Location
    United states
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Darren884
    I get these errors:
    Warning: Wrong parameter count for mysql_query() in /home/httpd/vhosts/rutherfordrealestate.net/httpdocs/edit.php on line 31

    Warning: Wrong parameter count for mysql_result() in /home/httpd/vhosts/rutherfordrealestate.net/httpdocs/edit.php on line 36

    For these lines:
    $sqlQuery = "SELECT * FROM Users";
    $result = mysql_query($sqlQuery, 0, "Username");

    $accountlevel = mysql_query("SELECT Accountlevel FROM Users WHERE Username='$loggedid'");
    $accountid = mysql_result($accountlevel);
    echo "$accountid";

    $accountid = mysql_result($accountlevel);

    after this line, you need to call for mysql_fetch_array
    like this

    $output = mysql_fetch_array($accountid);
    echo "$output[row]"; // it will be an array


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
  •