---
title: "Example of mvc"  
description: "Example of mvc"  
author: "Anonymous User"  
published: 2014-11-17  
updated: 2014-11-18  
canonical: https://www.mindstick.com/forum/12617/example-of-mvc  
category: "asp.net mvc"  
tags: ["jquery", "php", "mvc"]  
reading_time: 2 minutes  

---

# Example of mvc

this is a General [Question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) about MVC ..

I wrote a PHP [Class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) that send an [Array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) with Core JsonData [Strings](https://www.mindstick.com/forum/161912/explain-the-python-strings) to Jquery .. and on Jquery i´m accessing the data and add them to my views ( .append("htm stuff"+jsondata) )

now the Jquery is calling the data from a between.php page that has a [catch block](https://www.mindstick.com/forum/159348/how-does-an-exception-find-the-correct-catch-block) with many cases, and upon the called case/[function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) , the between page is calling a function from the php class that sends the [json data](https://www.mindstick.com/forum/782/how-to-send-request-amp-amp-response-from-json-data-using-asp-dot-net) ..

so i have my oop php model that send the core jsondata , a [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) ( catch block), and the view ( the jquery page) .. is this kind of MVC ? or i did miss understand it ?

an example of my code was posted on a [previous](https://yourviews.mindstick.com/view/81421/unlock-2-0-is-just-like-previous-corona-lockdowns) Question here.

## Replies

### Reply by Anonymous User

Looking at the code you posted in your other post it is not a MVC implementation. Or at least it is a bad implementation.

The MVC is about seperating your presentation from your business logic. Looking at your POST class you don't seperate your business logic from your view:

```
public static function readPosts(){    $query = new Post_db("SELECT * FROM pmessage                          ORDER BY p_id DESC                         ");     $posts = array();    while($row = $query->fetchRow()){        $posts [] = new Post($row);    }    foreach($posts as $item){        echo $item;    }}
```

In this function you get information from your database (business logic) and print content (view). In other words, you combine your MV in one method. So I would say: No, this is not MVC.


---

Original Source: https://www.mindstick.com/forum/12617/example-of-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
