I am unable to get a result from my MySQL query with PHP

  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

what am i doing wrong? it dont display the new.
one.php
Code: [ Select ]
$newcomment = $two->newcomment($user);
          echo $newcomment['new'];
  1. $newcomment = $two->newcomment($user);
  2.           echo $newcomment['new'];


two.php
Code: [ Select ]
function newcomment($user){
        $user= mysql_real_escape_string($user);
   $q = "SELECT * FROM ".mine." WHERE u = '$user' AND new = 'new' LIMIT 1";
      $result = mysql_query($q, $this->connection);
      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
   return NULL;
  }
  return $result;
 }
  1. function newcomment($user){
  2.         $user= mysql_real_escape_string($user);
  3.    $q = "SELECT * FROM ".mine." WHERE u = '$user' AND new = 'new' LIMIT 1";
  4.       $result = mysql_query($q, $this->connection);
  5.       /* Error occurred, return given name by default */
  6.       if(!$result || (mysql_numrows($result) < 1)){
  7.    return NULL;
  8.   }
  9.   return $result;
  10.  }
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

You need the mysql_fetch_row function in there as well

Also, it's mysql_num_rows and not mysql_numrows.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: Liamw411 and 42 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.