Wednesday 20 April 2022

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
});

Thursday 14 November 2019

Adding Excel export button hides/removes the Page Length Dropdown in Data Tables

Add below line in javascript table initialization

"dom": '<"top"Bf>rt<"bottom"lip><"clear">'

Complete Code 
<script>
        $(document).ready(function () {       
        $('#example').DataTable( {
                "processing": true,               
                "lengthMenu": [[25, 50, -1], [ 25, 50, "All"]],
                "dom": '<"top"Bf>rt<"bottom"lip><"clear">',
                "serverSide": true,
                "ajax": "server_processing.php"
            } );
        });                     

</script>