+ Reply to Thread
Results 1 to 6 of 6

Thread: what's wrong with this syntax?

  1. #1
    miocene2 is offline x10Hosting Member miocene2 is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    15

    Arrow what's wrong with this syntax?

    PHP Code:
    $result2 mysql_query("SELECT * FROM userpayments WHERE userid = $userid[$k] ORDER BY id ASC"); 
    I suspect it's something to do with the userid = $userid[$k] bit but not sure what the correct suntax is.

    Can someone help me out?? Cheers

  2. #2
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: what's wrong with this syntax?

    It has to be like this:

    PHP Code:
    $result2 mysql_query("SELECT * FROM userpayments WHERE userid = {$userid[$k]} ORDER BY id ASC"); 
    Other than simple variable calls, curly braces are needed.
    Last edited by Twinkie; 07-27-2009 at 05:18 PM.

  3. #3
    miocene2 is offline x10Hosting Member miocene2 is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    15

    Re: what's wrong with this syntax?

    Thanks. Got another prob now:

    using this code:

    PHP Code:
    $result2 mysql_query("SELECT * FROM userpayments WHERE userid = {$userid[$k]} AND paymentid = $payid ORDER BY paymentid ASC");
    while(
    $row2 mysql_fetch_array($result2)) 
    Gives me this error:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/miocene1/public_html/includes/getdata.php on line 52

    Edit: Nevermind got one of my column names wrong
    Last edited by miocene2; 07-27-2009 at 05:32 PM.

  4. #4
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: what's wrong with this syntax?

    That would be because the mysql query is coming back with no results. You will have to go into PHPmyAdmin and see what wrong. Or, you can post whats in those variables (what the query resolves to, $userid, and page link), and the mysql database entry you are trying to find here as well as the table structure. To me, the first one is easier

  5. #5
    miocene2 is offline x10Hosting Member miocene2 is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    15

    Re: what's wrong with this syntax?

    Thanks all sorted now!

  6. #6
    erhalo is offline x10Hosting Member erhalo is an unknown quantity at this point
    Join Date
    Feb 2009
    Posts
    28

    Re: what's wrong with this syntax?

    This helped me also thank you

+ Reply to Thread

Similar Threads

  1. What's wrong with this SQL Query?
    By Derek in forum The Marketplace
    Replies: 3
    Last Post: 07-23-2008, 10:00 PM
  2. cron job syntax wrong? [delete, i fixed it]
    By -fedexer- in forum Free Hosting
    Replies: 1
    Last Post: 04-06-2008, 03:21 PM
  3. Need help with Syntax Error
    By tam-iam in forum Scripts & 3rd Party Apps
    Replies: 0
    Last Post: 02-25-2008, 07:21 AM
  4. Mysql syntax
    By taekwondokid42 in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 09-16-2007, 08:04 AM
  5. [Apache] Syntax error in httpd.conf
    By flapietoetoe in forum Scripts & 3rd Party Apps
    Replies: 7
    Last Post: 06-04-2006, 04:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers