Wednesday 20 April 2022

Data Model

Data Model is a collection of concepts that can be used to describe the structure of the database. Structure means data types, relationships, constraints etc. DBMS allows a user to define the data to be stored in terms of a data model. 

1.  High-level data models 

2.  Low-level data models

3. Representational or Implementation data models 

High-level Data Models

Use set of concepts to describe the database, where the descriptions are close to user views. High-level data models are also known as conceptual models. In conceptual data modeling we use concepts like – entity, attributes, relationship etc. 

Low-level Data Models

Give details about how the data is stored in a computers (storage level details).

Representational/Implementation Data Models

This is in between high-level and low-level data models. Here we represent the concepts described in conceptual model using a specific structures like, networks, objects, tables, trees etc. Ex: Relational Model, NW Model, Hierarchical Model, Object Model, Object relational model etc. 

Relational Model

The central data description construct in this model is a relation, which can be thought of as a set of records. 

Schema

Description of data in terms of a data model is called a schema. A relation schema specifies the name of the relation, fields, type etc. 

eg:. Student (sid: string; name: string; age: integer) every row follows the schema of the relation.

The following are some important representational data models (DBMS Specific) 

1. Network Model

Though the basic structure is a record, the relationships are captured using links. The database can be seen as an arbitrary network of records connected by links. Ex.: GE’s Integrated Data store (IDS), in Early 1960s 

2. Hierarchical Model 

The records containing data are organized as a collection of trees. Ex.: IBMs IMS (Information Management System), in late 1960s 

3. Relational Model (early 1970s)

Data & relationships are captured as tables & keys. Ex.: Oracle, IBMs DB2, MySQL, Informix, Sybase, MS Access, Ingress, MySQL etc. The basic storage structure is a record. 

4. Object Data Model

Objects created through object–oriented programs can be stored in database. Ex.: Object Store 

5. Object Relational Model

Objects can be stores in tables. Ex.: Oracle, Informix 

Database Schema

Description of a database is called as database Schema.

Three-Schema Architecture:

A database can be described using three different levels of abstractions. Description at each level can be defined by a schema. For each abstraction we focus on one of the specific issues such as user views, concepts, storage etc. 

1. External schema: Used to describe the database at external level. Also described in terms of the data model of that DBMS. This allows data access to be customized at the level of individual users/groups/applications. Any external schema has one or more views and relations from the conceptual schema. This schema design is guided by end user requirements. 

2. Conceptual schema (logical schema) Describes the stored data in terms of the data model specific to that DBMS. In RDBMS conceptual schema describes all relations that are stored in the database. Arriving at good choice of relations, fields and constraints is known as conceptual database design. 

3. Physical schema: Describes the physical storage strategy for the database. 

Tuesday 19 April 2022

Fatal error: Cannot redeclare Function() in PhP

Fatal error: Cannot redeclare count_words() (previously declared) in PhP
Solution
1. Don't declare a function inside a loop. Declare before them.
or
You should include the file (wherein that function exists) only once. So instead of
include ("function.php");
use     
include_once("function.php");


Monday 18 April 2022

Integrate TinyMCE Editor in PhP

1. Download the latest version of TinyMCE SDK 

    https://www.tiny.cloud/get-tiny/

2. Extract the folder [tinymce] and put in your application root folder.

eg: C:\xampp\htdocs\tinymcedemo\tinymce [tinymcedemo is the root folder]

3. Create a php file "test.php" and place the below code 

<!DOCTYPE html>
<html>
<head>
  <script src="tinymce/tinymce.min.js"></script>
  <script type="text/javascript">
  tinymce.init({
    selector: '#mytextarea'
  });
  </script>
</head>
<body>
  <h1>TinyMCE </h1>
  <form method="post">
    <textarea id="mytextarea"></textarea>
  </form>
</body>
</html>

How to disable phpinfo() in a hosting environment?

Login to server WHM as a root user

Edit the php.ini file. Add below line

disable_functions = phpinfo

Restart the server

Friday 15 April 2022

Fatal error: Cannot pass parameter by reference in PHP

Fatal error: Cannot pass parameter  by reference in PHP.

$stmt->bind_param("ssss",$userid,$theme,$title,"test");

The error is with 'test' in the bind_param call.

All parameters to bind_param must be passed by reference. A string is a primitive value, and cannot be passed by reference.

You can fix this by creating a variable and passing that as a parameter instead:

$testvar="test";

$stmt->bind_param("ssss",$userid,$theme,$title,$testvar);

Enable or disable the "Powered by TinyMCE" branding.

Tinymce branding property allow you to enable or disable the "Powered by TinyMCE" branding.

tinymce.init({
  selector: 'textarea',  
  branding: false
});