Found 10 Questions For Server Side Programming

How to Send Realtime Notifications if User Follow using PHP & Mysql

Updated on 17-Mar-2023 21:31:15
Hello there, in this tutorial we will learn how to send real-time notifications to a user when someone follows them, you can use a combination of PHP and MySQL along with a WebSocket connection. Here are the steps: 1. Create a database table to store the followers information. The table should have at least three columns: id, follower_id, and user_id. The id column should be an auto-increment primary key, follower_id column should store the id of the user who is following, and user_id colum... Read Mores

Add and Delete Images from the Server in TinyMCE editor using PHP

Updated on 02-Apr-2023 15:05:07
Hello there, In this tutorial we will learn how to add and delete images from the server using TinyMCE editor callback and AJAX code, you can use the following steps: Step 1: Create a PHP script on your server that will handle uploading the image file. Let's call it upload_image.php. The script should take the uploaded image file, save it to the server, and return the URL of the saved image. <?php$targetDir = "uploads/";$targetFile = $targetDir . basename($_FILES["file"]["name"]);if (move_up... Read Mores

What is the difference between echo, print, and print_r in PHP?

Updated on 30-Jan-2023 19:33:01
echo: echo is not a function rather it is described as a language construct. It accepts an list of argument (multiple arguments can be passed) and returns no value or returns void. It cannot be used as a variable function in PHP. It is used to display the output of parameters that is passed to it. It display the outputs one or more strings separated by commas.Example:<?php// Code by Codegyan// PHP program to illustrate echo  // Declare variable and initialize it.$x = "Codegyan ";$y ... Read Mores

How to echo HTML in PHP ?

Updated on 29-Jan-2023 13:18:02
While making a web application with PHP, we often need to print or echo few results in form of HTML. We can do this task in many different ways. Some of methods are described here:1. Using echo or print: PHP echo or print can be used to display HTML markup, javascript, text or variables.Example 1: This example uses PHP echo to display the result.<?php     $name = "Codegyan";    echo "<h1>Hello User, </h1> <p>Welcome to {$name}</p>";?>Output:... Read Mores

PHP Date and Time Function

Updated on 26-Jan-2023 14:42:35
In this tutorial, we will see how to get the date & time using the date() & time() function in PHP, we will also see the various formatting options available with these functions & understand their implementation through the examples.Date and time are some of the most frequently used operations in PHP while executing SQL queries or designing a website etc. PHP serves us with predefined functions for these tasks. Some of the predefined functions in PHP for date and time are discussed ... Read Mores

What does ‘<?=’ Short Open Tag Mean in PHP ?

Updated on 29-Mar-2024 0:08:15
PHP, a powerful server-side scripting language, offers various features to enhance developer productivity. One of these features is the ‘<?=’ short open tag, which provides a convenient shorthand for echoing variables and expressions. In this comprehensive guide, we will delve into the meaning, syntax, usage, and best practices surrounding the ‘<?=’ short open tag in PHP. What is the ‘<?=’ Short Open Tag? The ‘<?=’ short open tag is a concise syntax in PHP used to o... Read Mores

See (stage) your website before switching your DNS

Updated on 01-Nov-2021 9:06:42
When customers are looking to switch hosting providers, they usually stage the setup of their web site before completely switching the DNS (domain name servers). We provide you with a temporary URL so that you can see how your site will look before you switch your domain’s DNS. The problem comes when some scripts require you to access the script through a valid domain name. This poses an issue because you haven’t switched the domain’s DNS and don’t want to until you know the script works... Read Mores

How can we create recursive functions in Python?

Updated on 30-Oct-2021 14:38:44
Recursion is a programming method, in which a function calls itself one or more times in its body. Usually, it is returning the return value of this function call. If a function definition follows recursion, we call this function a recursive function. Also Read : How to get a list of parameter names inside Python function? A recursive function has to terminate to be used in a program. It terminates, if with every recursive call the solution of the problem is becomes smaller and moves towards ... Read Mores

How to make a chain of function decorators in Python?

Updated on 30-Jan-2023 19:39:21
Decorators are “wrappers”, which allow us to execute code before and after the function they decorate without modifying the function itself. Example The given code can be wrapped in a chain of decorators as follows. def makebold(fn): def wrapped(): return "" + fn() + "" return wrapped def makeitalic(fn): def wrapped(): return "" + fn() + "" return wrapped @makebold @makeitalic def hello(): return "hello world" print hello() Output C:/Users/codegyan/ hel... Read Mores

What are Python function attributes?

Updated on 03-Oct-2021 13:29:18
Everything in Python is an object, and almost everything has attributes and methods. In python, functions too are objects. So they have attributes like other objects. All functions have a built-in attribute __doc__, which returns the doc string defined in the function source code. We can also assign new attributes to them, as well as retrieve the values of those attributes. For handling attributes, Python provides us with “getattr” and “setattr”, a function that takes three arguments.... Read Mores