hi everybody,

i created three table planbook,like and user table.
what is the problem in this code.
nothing to error msg display.but did not like count store in database

class planbook

public function  get_like_count($planbookId)
{
    $planbook_id= $planbook_id;
    $planbook_obj=Doctrine_Query::create() ->select('p.planbook_like')->from('planbook p')
    ->where('p.planbook_id =?', $planbookId);
    $result=$planbook_obj->fetchArray();


}

  public function add_like_count($planbookId)
  {
     $stmt=mysqli_prepare($this->connection,"update planbook set planbook_like=planbook_like+1 where planbook_id=?");
     mysqli_stmt_bind_param($stmt,'i',$planbookId);
     $this->throwExceptiononError();
     mysqli_stmt_excute($stmt);
     $this->throwExceptionOnError();
     return true;





class LikeTable extends Doctrine_Table
{
    /**
     * Returns an instance of this class.
     *
     * @return object LikeTable
     */


     public function  addlike($persoanlId,$planbookId)
     {
         $like= new Like();
         $like->setPersonalId($personalId);
         $like->setPlanbookId($planbookId);
          $like->save();

     }

javascript.

function like_add(planbook_id)
{

    $.ajax({
   url:  $(".planbook").html(),
 type: 'POST',
                data: { personalId:personalId,  planbookId:planbookId },
 success: function(data, textStatus, jqXHR){
               like_get(planbook_id);
                       }
    });


}


function like_get(planbook_id) {

 $.ajax({
 url: $('.planbook').html(),
 type: 'POST',
                data: { personalId:personalId,  planbookId:planbookId },
                success: function(data, textStatus, jqXHR){
   $('#planbook_'+planbook_id+'_likes').text(Data);

       }
    });


}

Its not updating or inserting in Likes table? manually run your queries by echoing it and see what you get?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.