Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2005
    Location
    Up North
    Posts
    1,002
    Tokens
    93

    Latest Awards:

    Default Anybody see the problem in this?

    PHP Code:
    $new mysql_query("select * from pm where readdate = '0' and to = '$logged[id]'");
    $new mysql_num_rows($new); 
    which should select all the rows from pm where readdate=0 and the to=the logged user

    then further down i've got this

    Code:
    - <a href=\"messages.php\">Private Messages ($new New)</a><br />
    I'm using the techtuts system but with a different database structure, but it doesnt seem to change even if i make it simple and put select from pm where to = 2

    but nuffink

    Sorry i forgot to say my error, it says ( New) as in theres no new, but there is new ones
    Last edited by .:.:jjm261:.:.; 27-09-2008 at 11:25 AM.

  2. #2
    Join Date
    Jun 2008
    Location
    Manchester
    Posts
    766
    Tokens
    0

    Default

    I don't know much about php or mysql, but shouldn't it be something like this:
    PHP Code:
    $new mysql_query("select * from ´pm´ where ´readdate´ = '0' and ´to´ = '$logged[id]'");
    $new mysql_num_rows($new); 

  3. #3
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    $new mysql_query"SELECT * FROM pm WHERE readdate = '0' AND to = '{$logged[id]}'" ) or die( mysql_error( ) );
    $new mysql_affected_rows( ); 
    Last edited by Decode; 27-09-2008 at 12:24 PM.
    Lets set the stage on fire, and hollywood will be jealous.

  4. #4
    Join Date
    Oct 2005
    Location
    Up North
    Posts
    1,002
    Tokens
    93

    Latest Awards:

    Default

    Well apparantly it was in the wrong place =[ i'm stupid

    but now i'm getting this error

    Code:
    Warning:  mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/easymitc/public_html/Feudel/arcade/mattssystem/login.php on line 145
    and with your code i'm getting this
    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 'to = '2'' at line 1
    Last edited by .:.:jjm261:.:.; 27-09-2008 at 01:05 PM.

  5. #5
    Join Date
    Feb 2007
    Location
    Essex, England
    Posts
    1,392
    Tokens
    0

    Latest Awards:

    Default

    Don't use $new twice.

    I'm not sure if that's it but I did it once and php didn't like it.


  6. #6
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by L?KE View Post
    Don't use $new twice.

    I'm not sure if that's it but I did it once and php didn't like it.
    That has nothing to do with the problem...

    I think its because you are using "to" as a column name, so mysql thinks you are trying to get it to do an action. (Im not 100% sure!)
    Lets set the stage on fire, and hollywood will be jealous.

  7. #7
    Join Date
    Oct 2005
    Location
    Up North
    Posts
    1,002
    Tokens
    93

    Latest Awards:

    Default

    Yes, it was that,

    i did the query in phpmyadmin and it showed to as a function so i put it in ` and it worked

    Thanks for all your help

Posting Permissions

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