Articles on Trending Technologies

Technical articles with clear explanations and examples

Which PHP function is used to delete an existing database?

vanithasree
vanithasree
Updated on 15-Mar-2026 289 Views

PHP uses the mysql_query() function to delete a MySQL database. However, this function is deprecated since PHP 5.5.0 and removed in PHP 7.0.0. Modern PHP applications should use mysqli or PDO instead. Syntax (Legacy) bool mysql_query( sql, connection ); Parameters Parameter Description sql Required. SQL query to delete a MySQL database (DROP DATABASE command) connection Optional. If not specified, the last opened connection by mysql_connect will be used Modern Approach Using MySQLi Here's how to delete a database using the recommended MySQLi extension ? ...

Read More

Write an example to establish MySQL database connection using PHP script?

Krantik Chavan
Krantik Chavan
Updated on 15-Mar-2026 404 Views

In PHP, you can establish a MySQL database connection using MySQLi or PDO extensions. The old mysql_connect() function is deprecated and should be avoided. Here are modern approaches to connect to MySQL database. Using MySQLi (Procedural) The MySQLi extension provides an interface to access MySQL databases − Using MySQLi (Object-Oriented) The object-oriented approach provides better code organization − Using PDO PDO (PHP Data Objects) provides a database-agnostic interface − Comparison Method Object-Oriented Prepared Statements Database Support ...

Read More

Which PHP function is used to disconnect from MySQL database connection?

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 472 Views

PHP provides the mysql_close() function to disconnect from a MySQL database connection. This function takes a single parameter, which is a connection resource returned by the mysql_connect() function. Syntax bool mysql_close ( resource $link_identifier ); Here, if a resource is not specified, then the last opened database connection is closed. This function returns true if it closes the connection successfully, otherwise it returns false. Example The following example shows how to connect to and disconnect from a MySQL database − Important Note Deprecated Functions: The mysql_close() function ...

Read More

What are the differences between JavaScript and PHP cookies?

Anvi Jain
Anvi Jain
Updated on 15-Mar-2026 983 Views

Cookies are text files stored on the client's browser to remember user information across web pages. Both JavaScript and PHP can work with cookies, but they operate differently − JavaScript handles cookies on the client-side while PHP manages them on the server-side. JavaScript Cookies JavaScript cookies are manipulated directly in the browser using the document.cookie property. They're ideal for client-side data storage and immediate user interactions. Setting a Cookie with JavaScript // Set a cookie that expires in 7 days document.cookie = "username=john; expires=" + new Date(Date.now() + 7*24*60*60*1000).toUTCString() + "; path=/"; Reading ...

Read More

How to pass JavaScript variables to PHP?

Johar Ali
Johar Ali
Updated on 15-Mar-2026 21K+ Views

You can pass JavaScript variables to PHP using several methods. Since PHP runs on the server and JavaScript runs in the browser, direct variable passing isn't possible. However, you can achieve this through AJAX requests, form submissions, or by embedding JavaScript values in PHP output. Method 1: Using AJAX POST Request The most common approach is to send JavaScript variables to PHP using AJAX − Pass JS to PHP Send Data to PHP ...

Read More

How to call Python file from within PHP?

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 15-Mar-2026 11K+ Views

In PHP, you can execute Python scripts using built-in functions like shell_exec(), exec(), or proc_open(). Each method offers different levels of control over the process. Using shell_exec() The simplest approach − runs a command via the shell and returns the output as a string. Use escapeshellcmd() to sanitize the command ? The square of 4 is 16 Specifying the Python Interpreter If the script lacks a shebang line (#!/usr/bin/env python3), explicitly call the interpreter ? The square of 5 is 25 ...

Read More

Is there something available in Python like PHP autoloader?

Sumana Challa
Sumana Challa
Updated on 15-Mar-2026 535 Views

No, Python does not have a direct equivalent to PHP's autoloader, and it doesn't need one. The two languages handle module loading fundamentally differently. Why PHP Needs Autoloaders PHP starts a fresh process for each web request, loading all code from scratch every time. Autoloaders optimize this by loading classes only when they are first used, avoiding the cost of loading unnecessary files on every request. Why Python Doesn't Need One Python imports modules once when the application starts. The module stays in memory (sys.modules) for the lifetime of the app. Subsequent requests reuse the already-loaded ...

Read More

How to get the POST values from serializeArray in PHP?

Ricky Barnes
Ricky Barnes
Updated on 15-Mar-2026 3K+ Views

The jQuery serializeArray() method serializes form elements into a JSON array of name-value pairs. When sent via $.post(), PHP receives these values through the $_REQUEST or $_POST superglobal. PHP Backend (serialize.php) This file receives and displays the POST values ? jQuery Frontend (HTML) The form collects user data and sends it using serializeArray() ? $(document).ready(function() { $("#driver").click(function(event) ...

Read More

PHP Soap Client is not supporting WSDL extension while connecting to SAP system

Hayat Azam
Hayat Azam
Updated on 15-Mar-2026 649 Views

When integrating PHP SOAP Client with SAP systems, you may encounter issues with WSDL extensions due to WS-Policy requirements. SAP's policy framework can prevent PHP SOAP clients from properly consuming web services. Here are two solutions to resolve this. Solution 1: Modify Policy Requirements Update the policy tag in your WSDL to make it optional instead of required. Find this line ? Change it to ? Test your PHP SOAP client connection after making this change to verify the service works correctly. Solution 2: Change URL Endpoint ...

Read More

How to access a collection in MongoDB using Python?

Priya Mishra
Priya Mishra
Updated on 15-Mar-2026 2K+ Views

MongoDB is a well-known NoSQL database that offers a scalable and flexible approach to store and retrieve data. Using Python with MongoDB enables developers to interact with database collections effortlessly through the PyMongo library. This article explains how to access a MongoDB collection using Python, covering the required steps, syntax, and techniques for connecting to, querying, and manipulating data. Syntax from pymongo import MongoClient # Connect to MongoDB client = MongoClient('mongodb://localhost:27017/') # Access database and collection db = client.database_name collection = db.collection_name # Perform operations collection.insert_one(document) collection.find(query) collection.update_one(filter, update) collection.delete_one(filter) PyMongo ...

Read More
Showing 22761–22770 of 61,299 articles
Advertisements