Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    do I got the wrong idea??

    if inside if
    Parse error: parse error, unexpected T_ELSE

    if ($determin)
    {

    $query = "SELECT * FROM `JS` WHERE `wrdprc` LIKE `$mkrs`";
    $good_query=mysql_query($query);
    if (mysql_num_rows($good_query) == 0)
    { { $query = "SELECT * FROM `JS` WHERE `wrdprc` LIKE `m` LIMIT 0"; }
    else
    { $query = "INSERT INTO `JS` ( `id` , `wrdprc` , `wrdnprc` , `pgld` ) VALUES ( '', '$mkrs', '', '0' )";
    $exec = mysql_query($query) or die (""); } }

    }

  • #2
    Regular Coder
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    528
    Thanks
    8
    Thanked 8 Times in 8 Posts
    Your script is badly aligned.. It's easier to keep track of your script to see any faults if written in a building format: eg.

    PHP Code:
    if ($determin) { 

        
    $query "SELECT * FROM `JS` WHERE `wrdprc` LIKE `$mkrs`"
        
    $good_query=mysql_query($query); 

        if (
    mysql_num_rows($good_query) == 0) {  

            
    $query "SELECT * FROM `JS` WHERE `wrdprc` LIKE `m` LIMIT 0"

        } else { 

            
    $query "INSERT INTO `JS` ( `id` , `wrdprc` , `wrdnprc` , `pgld` ) VALUES ( '', '$mkrs', '', '0' )"
            
    $exec mysql_query($query) or die (""); 

        }  


    What I just put here is the correct script also.. you had too many { } around the line: $query = "SELECT * FROM `JS` WHERE `wrdprc` LIKE `m` LIMIT 0";

  • #3
    New Coder
    Join Date
    Feb 2005
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks, I will keep that thought
    Im using code together from other projects

    Iam getting the error
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

    mysql_num_rows():
    is used on my server in different pages what could this be?

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Usually get that error if there's no results found, or an error in your query.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •