SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error , But Where ???

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Inetpub\vhosts\autentica.biz\httpdocs\autestica\index.php on line 159


    THIS THE CODE :

    $result = mysql_query("SELECT pr_code, pr_totbedrooms, pr_name, pr_sellingprice, pr_descuk, (select prtypology_uk from prtypology where prtypology_code=$criteria_property) AS property_type FROM property WHERE (property.pr_type='0$criteria_property,' OR property.pr_type LIKE '%,0$criteria_property,%' OR property.pr_type LIKE '%$criteria_property,%') AND property.pr_publishonottk=-1");



    $num = mysql_num_rows($result);


    echo "<h2>Found objects: $num </h2>";

    please help ...

    check error
    still error
    Last edited by baddawg; May 26, 2005 at 22:31.

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    AU
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like there is a problem with your query, try printing out mysql_error() ie.
    PHP Code:
    $result mysql_query("SELECT pr_code, pr_totbedrooms, pr_name, pr_sellingprice, pr_descuk, (select prtypology_uk from prtypology where prtypology_code=$criteria_property) AS property_type FROM property WHERE (property.pr_type='0$criteria_property,' OR property.pr_type LIKE '%,0$criteria_property,%' OR property.pr_type LIKE '%$criteria_property,%') AND property.pr_publishonottk=-1") or die (mysql_error()); 
    that should tell you what is wrong.

  3. #3
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    the error

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select prtypology_uk from prtypology where prtypology_code=sele

    that's the error
    i have no idea where to begin
    help here needed desperately....

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    AU
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should place quotes around your variabes, try this and see if you get the same error:
    PHP Code:
     $result mysql_query("SELECT pr_code, pr_totbedrooms, pr_name, pr_sellingprice, pr_descuk, (select prtypology_uk from prtypology where prtypology_code='$criteria_property') AS property_type FROM property WHERE (property.pr_type='0'$criteria_property',' OR property.pr_type LIKE '%,0'$criteria_property',%' OR property.pr_type LIKE '%'$criteria_property',%') AND property.pr_publishonottk=-1") or die (mysql_error()); 

  5. #5
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    error still

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select prtypology_uk from prtypology where prtypology_code='sel

    error message

  6. #6
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    AU
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What version of mysql are you using? subqueries are only supported from 4.1 onwards.

  7. #7
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    wel ther we go with the error

    i am useing 3.5.4

    any suggestion how to do this querry
    ???

  8. #8
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    AU
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Only way I can think of off hand is do multiple queries, sorry :\

  9. #9
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    made some changes please help

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select property',' OR property.pr_type LIKE '%,0'select propert------> error

    code:
    $made = mysql_query ("select prtypology_uk from prtypology where prtypology_code='$criteria_property'");

    $result = mysql_query("SELECT pr_code, pr_totbedrooms, pr_name, pr_sellingprice, pr_descuk,'$made' AS property_type FROM property WHERE (property.pr_type='0'$criteria_property',' OR property.pr_type LIKE '%,0'$criteria_property',%' OR property.pr_type LIKE '%'$criteria_property',%') AND property.pr_publishonottk=-1") or die (mysql_error()); print "this is (mysql_error()) !";
    $num = mysql_num_rows($result);


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
  •