Questions tagged [php]

PHP is a versatile scripting language that was initially developed for server-side web development. It is open-source, supporting multiple paradigms and possessing dynamic typing capabilities. If you have any queries regarding PHP programming, feel free to use this tag.

Trouble accessing contacts on LinkedIn

When attempting to retrieve the LinkedIn connections for a logged-in user, I used the following API Request: However, I encountered an error message: { "errorCode": 0, "message": "Access to connections denied", "requestId": "OFP0JOLOHO", "status" ...

Tips for determining if the elements of an array are nearly identical

There is a collection of seven numbers in my array: array(159.60, 159.60, 159.60, 159.60, 159.60, 199.50, 199.50); array(395.68, 395.68, 395.68, 395.68, 395.68, 395.68, 395.68); array(531.18, 531.18, 531.18, 531.19, 531.18, 531.18, 531.18); I am facing t ...

Issue with JavaScript not executing upon clicking the submit button on a form within the Wordpress admin page

In the admin pages of my Wordpress installation, I have created an HTML form. My goal is to validate the data inputted when the submit button is pressed using a Javascript function. If the data is not correctly inserted, I want alerts to be displayed. Desp ...

Implementing API token authorization in Laravel 5.5

Currently, I am in the process of authenticating our users through the API token. This is the snippet from my config/auth.php file: 'guards' => [ 'web' => [ 'driver' => 'session', ...

Is it possible to execute PHP without using Ajax when clicking on a Font Awesome icon?

So, besides using Ajax, is there another solution to achieve the same result? Can a font-awesome icon be turned into a button without Ajax? In case you're unfamiliar with what I mean by a font-awesome icon, here's an example: <i id="like1" onClick="lik ...

Error Caused by UTF-8 Double Encoding

My database stores data as utf8_unicode. When connecting, I use: mysql_query("SET NAMES 'utf8'"); However, the data is not displaying properly and instead shows diamond symbols for special characters. If I remove: <meta http-equiv="Content ...

Internet Explorer experiences performance issues when a table containing over 500 rows is being utilized

Can anyone offer advice on speeding up the display of large tables with 500+ rows in Internet Explorer? Here is my current approach: The MySQL query result includes 500+ rows, which I then loop through using a while loop to display: echo "<tr class=' ...

Transferring data asynchronously with AJAX to a PHP script

How can I send $username using PHP with data: new FormData(this),$username to the add.php file using AJAX code? <script type="text/javascript"> $(document).ready(function (e) { $("#uploadFormuserimg").on('submit',(function(e) { ...

PHP problem with uploading files

It's been a frustrating day trying to figure out why this script isn't working properly. When I try to upload a file, the page loads but there is no image displayed. I'm new to file and image uploads, so I've experimented with different ...

Laravel : How to utilize Eloquent to perform joins within a query

Within my database, I am working with five tables where I need to extract data from all of them: post, product, categories, attributes, post_attribute Currently, I have a query in my model that retrieves all posts for a particular product, including detai ...

Issue with sender field in contact form and mailer function

Having issues with my contact form that has 3 fields and a textarea... I've used jQuery for validation and PHP to handle email sending. The contact form is functioning correctly, but the From field in the received emails is not displaying as expected. I ...

How can I transform IIS rewrite rules into Nginx rewrite syntax?

I am in the process of converting an IIS rewrite rule into Nginx rewrite syntax. Specifically, I need to rewrite a URL such as /leaderboard to /pages.php?page=leaderboard. This is the current IIS Rewrite Rule I have: <match url="^([^/]+)/?$" / ...

php if statement in PHP not working as intended

I've scoured the forum without finding a solution to my issue. I need to generate different outcomes based on the data sent to my page. Here's the code: $picture=$_GET['pic']; echo "Picture ref= " . $picture . "<br>"; if ($pictur ...

Is it safe to utilize Ajax and jQuery in conjunction with a PHP script to authenticate a user during login?

Hey there! I have a question about the security of using the jQuery.post function in jQuery to send a user's login information to a PHP script. Here is the piece of code I am considering: $("#login_form").submit(function() { var unameval = $("#use ...

Is there a way to incorporate a text box in javascript that displays the retrieved reference count from the database?

I'm currently working on creating a functionality that retrieves rows with the same ID from a database and displays them in a text box. Below is the PHP code I've written for retrieving all the rows: PHP: <?php include_once('pConfig.php'); if ...

Having trouble saving an image to a MySQL database using PHP code

I am attempting to upload an image and save it in a MySQL database using PHP. However, I am facing an issue where the image is not being stored in the database. <form action="" method="post" name="frmUploadImage" class="box" enctype="multipart/form-dat ...

We're sorry, but the URL you were trying to access at /emr/login could not be found on this server

I recently began a new project using Laravel. Once I installed and updated the Composer, I ran my project and was able to see the home page. However, when I tried to access the Login Page of my project, it showed an error message: The requested URL /emr ...

Using the PHP mail() function to send an email with an attachment

I have developed two scripts for this specific HTML code along with a corresponding PHP script. Below is the HTML markup: <html> <body> <form action="http://senindiaonline.in/admar/non-series-numbers-db.php" method="post" target="_bl ...

Asking for an array of PHP objects using jQuery Ajax: a guide

I'm facing a challenge with passing an array of "Blocks" using Ajax. I have successfully created the "Blocks" using a PHP class and know how to pass an array with numbers through JSON, but I am unsure how to pass an array with objects. Do I need to c ...

Trouble with webpage design persists following recent modifications

Today, I decided to make some alterations on the header.php file of my WordPress website in order to tweak the flag icons displayed at the top of the page. However, when I refreshed the page, everything looked completely chaotic. Even after undoing all th ...

`How to update a PHP session variable with AJAX?`

As someone who is new to PHP and just beginning to delve into AJAX, I have a question. I am curious to know if it is possible to update a PHP SESSION VARIABLE using AJAX, and how exactly this can be achieved. I have attempted to find examples online, but ...

I am hoping to transmit an array from a function using Ajax and JSON

Having trouble sending a JSON array from a function. This is my code: function categoryTree($parent_id = 0, $sub_mark = ''){ global $connection; $query = 'SELECT * FROM ws_categories WHERE parent_id = :parent_id ORDER BY sort_order ASC, name ASC' ...

Implementing Jquery validation to check for duplicates when submitting an email form in Laravel

Hi, in my current Laravel project I am implementing a feature to check if an email is unique or not. At the front end, I have integrated jQuery code as shown below: blade.php page user_email: { required: true, email: true, remote: { ur ...

Tips for boosting performance in PHP when working with extensive arrays

Apologies if my question seems trivial, but I am seeking guidance on how to resolve a particular issue. Currently, I have a large multidimensional array that looks like the following: $array_value = Array ( [0] => Array ...

Retrieve data from the following fields: {"attending":0,"eventid":1,"userid":1} using PHP

After receiving an array from JAVA and using print_r($_POST), I have tried various methods to extract data but with no success. The format of the array is as follows: {"attending":0,"eventid":1,"userid":1} I've attempted different approaches found on SO ...

Why is the var_dump returning null?

Greetings, I am currently utilizing Zend Framework (PHP) and encountering an issue with the output of a select option value in var_dump after sending a POST request. Here is the code snippet: <div class="entry"> <form action="<?php echo $this ...

What is the best way to merge multiple pages along with their respective templates into a single page?

Is there a way for the CMS to have separate pages (such as "Careers", "Jobs", "Team"), each with its own template, but also be able to combine them into a single scrollable page named "Our Company" with its own template? How can this be achieved? I rememb ...

yii ajaxurl customization for table sorting

Here is some code I have: ajaxUrl : '<?php echo Yii::app()->createUrl("abc/def");?>&page={page}&size={size}&{sortList:col}&{filterList:fcol} ', Referenced from: http://mottie.github.io/tablesorter/docs/example-pager-aj ...

Update Android profile in MySQL table

I am currently working on an Android application for profile updates. Unfortunately, I am encountering an issue with retrieving JSON values as the result is coming back null. Can anyone help me pinpoint where the mistake might be? Profile Update Response: ...

Empty value for $_POST variable following xmlhttp request

When my code makes an xmlhttp request to a php file with an ID for record deletion from the database, I encounter an issue. The error message 'comicID' is undefined shows up when attempting to delete. This signifies that the variable containing the ID valu ...

Can someone assist me with navigating through my SQL database?

Struggling with a script that searches multiple fields in the same table, I need it to return results even if one or three parameters are left blank. My attempts using PHP and MySql have been fruitless so far, which is why I am reaching out to the experts ...

What could be causing MySQL to return a negative result when matching against columns?

Recently, I discovered the amazing benefits of using MySQL's match against, but encountered some unexpected issues. I noticed that when the joined table2 has no paired rows, MySQL's match against function returns a negative value for the join column with ...

Leveraging jquery's $.ajax method to send GET values to a PHP endpoint

Is it possible to use an AJAX call to pass a value to a PHP script? For example, if I have the URL example.com/test.php?command=apple, how can I make sure that the code is executed properly on the server side? This is how my code looks like: PHP: <?p ...

Is there a way to remove a certain child category post from appearing in a parent category?

I'm having trouble with displaying related posts by category while excluding a specific category. I've tried different methods but none seem to work, and I'm not sure how else to approach this issue. <?php $categories = get_the_terms ...

Click-o-Meter: Tracking Button Presses

I’m looking to develop a button click counter that increases every time it is downloaded. I want to implement this functionality without using a database. Here's the code snippet: <?php $counterFile = 'path/to/counter.txt' ; // This is wher ...

Transform and command the data acquired through an AJAX request using jQuery

My code includes an AJAX call using jQuery: $('.add a').click(function() { $.ajax({ type: 'POST', url: '/api/fos', context: this, datatype: 'html', success: function(data){ $(this).parents('tr').befo ...

Encountering the error message "Angular: invalid URL value sanitization" every time I attempt to refer to a folder within

I'm currently working on a project where I need to pull images from my disk into an Angular application using PHP as the backend for file retrieval. <ngb-carousel *ngIf="imageNames" class="carousel-fade"> < ...

Looking up information using PHP and MySQL

I've been working on a website project for my class, focusing on creating a search functionality that interacts with a MySQL database table to retrieve matching results. Despite my best efforts, the code I have written isn't functioning properly and I kee ...

What is causing the issue with transmitting the server datetime to my local jQuery script?

I am facing an issue with my timeoftheserver.php page setup. The PHP code is quite simple: <?php echo date('D, d M y H:i:s'); ?> Similarly, the script on my local machine is also straightforward: var today; try { today = new Date($.ajax({'typ ...

Retrieve records where the ID is not found in another table limited by a specific date range

Is it possible to use the 'where not in' and 'between date intervals' clauses separately instead of combining them into one query? $this->db->select('*'); $this->db->from('admission'); $this->db->w ...

When an AJAX call is made during a PHP session that has timed out

I am working on an AJAX form that handles data authentication. In the event of a session timeout, I need to implement a redirect to the login page. How can I go about achieving this? Here is an excerpt from my simplified server-side code: function doExecu ...

How can two classes be extended in PHP using OOP?

As a beginner in OOP, I am currently working on writing a PHP class to establish a connection with an FTP server. class ftpConnect { private $server; private $user; private $password; private $connection_id; private $connection_correct = false; ...

Executing an AJAX request to insert data into MySQL

After my extensive online search, I came across a solution that involves using ajax to set information in my database. While browsing through this page, I learned how to retrieve data from the database. My specific query is: can we also use ajax to set in ...

Looking to retrieve the image source from a SQL database and display it in a view file using Ajax in CodeIgniter?

I am new to PHP and have successfully created an AJAX dynamic dependent dropdown in CodeIgniter. It is working fine, but now I want to show an image for the selected option when the last dropdown's option is selected. Please help me with this. View a ...

Can you identify the mistake in the XML response?

I encountered an issue with my PHP code (getRout.php) which is meant to respond in XML format. The error message I received was: XML Parsing Error: no element found Location: http://127.0.0.1/direction2/getRout.php Line Number 1, Column 1: edit To view ...

Basic form submission versus using an Ajax loader mechanism

Handling forms can be done in various ways. One way is to submit the form and retrieve variables in PHP, while another method involves sending data with AJAX. During this process, a dialog can be displayed with information about processing the data, along ...

SQLSTATE[42S02]: The specified table or view cannot be found in the database: 1146 The table does not exist

Encountering an issue when trying to display data on the dashboard. I've established a relationship between a post and category table, assigned a category to the post, and attempted to call the category name from the category table on the dashboard, only t ...

Having trouble sending form data using the jQuery AJAX POST method?

I am facing an issue with a simple form that is supposed to send data to PHP via AJAX. However, when I submit the form, the data does not get sent across. Here is the JavaScript code: $(document).ready(function(e) { $('#update').submit(func ...

Enhance your Proguard and Gson skills by transforming variable names within an arraylist

During debugging, my code works perfectly fine. However, when I release my apk with Proguard 5, it obfuscates my variables. As a result, the string generated after "Jsonifying" is also obfuscated, causing issues with my PHP script. Here's an example of my ...

Merging AngularJS and CodeIgniter for efficient data transferIn this article, we explore the

Recently embarking on my journey to learn AngularJS, I've been considering building an application utilizing Codeigniter as the backend (as an API to handle data operations with a MySQL database) and AngularJS as the frontend framework. My main query is: W ...

Encountering issues with loading the database on the Android application

My challenge lies in using a single database for both an Android application and a website. This setup allows the admin to update the website and app simultaneously through one admin panel. The database, which consists of 15 tables, presents a roadblock ...

Is it possible to create a script to automatically update the zend_extension path in php.ini for php56-xdebug when performing a brew update?

After installing php56-xdebug and making changes to my php.ini file using homebrew, I recently updated my php56-xdebug to version 2.3.3 through a brew update && upgrade. This caused the directory listing of the xdebug.so file to change to /usr/loca ...

Setting specific variables in an array with corresponding key-value pairs

I need help with extracting specific columns from a table that has 5 columns. The columns in question are: column1, user_id, column3, column4, and user_exp. Let's say I have the following select query: $mat_sql = mysql_query( "SELECT * FROM users ...

Connecting a href link to a TAB

Check out this useful CODE example I am using. I have a webpage with links that have href attributes. Now, I want to link these pages to another page and have them automatically open a specific tab when clicked. Is this possible? Here are the links on th ...

Cannot seem to get my AJAX code working correctly to show comments

Having some trouble with my comment system code. The PHP part is working fine, comments are being inserted into the table without any issues. However, I am struggling with the Ajax part. The comments are not being displayed unless the page is reloaded. C ...

Utilizing Gmail's TLS-enabled Outgoing SMTP in PHP for Sending Emails

Currently, I am trying to send email from PHP using the Gmail SMTP server. I had everything set up and working smoothly with SSL over port 465, but unfortunately, my web host does not allow outgoing traffic over this port. However, they did inform me that ...

Design Inquiry: Ways to Display Online User Count?

Currently in the process of creating a LAMP web application. I'm looking for effective strategies to showcase the number of users who are currently logged into my site. My goal is to provide accurate real-time information such as "There are 1000 users on ...

Having trouble with Installing ownCloud on Raspberry Pi

Every time I attempt to open ownCloud, an error message appears stating: PHP module mb multibyte not installed. Please ask your server administrator to install the module. PHP modules have been installed, but they are still listed as missing? Please ask y ...

Run PHP code using JavaScript

I am currently using Windows and attempting to use JavaScript/PHP to call a specific form that is saved in a different location. The file D:\Test\Form.php has the following content: <form action="D:\Test\submit.php" method="post"&g ...

I encountered an error in Laravel that stated: "The visitor variable is

Hello, I am trying to add a comment to a blog while displaying the name of the patient who added it using session. However, I encountered the following error: Undefined variable: visitor This is the commentcontroller.php: public function store(blog $getI ...

AJAX cached outcomes

Trying to educate myself on AJAX using w3schools.com, but struggling with a particular example: xhttp.open("GET", "demo_get.asp", true); xhttp.send(); In the above example, there might be a cached result. To prevent this, you can include a unique ID in t ...

Is it possible for http://productionsite.com hyperlinks to be redirected to http://localhost/productionsite within a WAMP environment?

Typically, I prefer using absolute paths in the majority of my applications. I recently started using a wamp server for development and I'm curious if there's a way to mimic the production path with the localhost path. For instance, instead of ...

Having a pair of submit buttons within a single form

I need assistance regarding a form with five file input controls and other various controls. Additionally, there are two submit buttons included within the form structure. Utilizing the JQuery Validation plugin for validating form inputs has been an essen ...

Joining multiple tables in MySQL can help consolidate data from

Building a Support System A unique support system is being developed where users from specific countries can raise issues in different categories. These issues are then assigned to experts based on their country, administrative division, and category expe ...

Updating MariaDB records with JSON nested arrays using PHP's On Duplicate Key Update feature

Here's an interesting challenge I'm facing. I am currently in the process of integrating a third-party POS system into a custom inventory management software that I created for a client some time ago. The system I built uses PHP, HTML, and JavaSc ...

Steps for storing div content (image) on server

Currently in the process of developing a web application that allows users to crop images. The goal is for users to have the ability to email the URL so others can view the cropped image, ensuring that the URL remains active indefinitely by storing every c ...

option for uploading various data to the database using (php, ajax)

I am using a foreach loop to display data from the database on the screen. However, when I click the button, I do not see any results. Can someone please help me identify where I may be making mistakes? <table class="table"> <thead class="the ...

What server-side PHP script should be used for file uploading with a progress bar in the jquery.form.js?

I am having trouble setting up a file upload function similar to the one demonstrated at http://jquery.malsup.com/form. The example provides a progress bar for file uploads, but it does not include an example of the server-side script. Although I know how ...

Challenges related to maintaining a webpage's content using AJAX

I have a form that I want to use to send and insert the values into my database. After the values are inserted, I would like to clear the input fields of the form and display a success message. Here's an example of how I would like it to look: Clear the ...

Fetch and showcase JSON information from a CodeIgniter method

Is there a way to retrieve data from a SQL database using ajax (json) with Codeigniter or PHP? I have attempted it, but the result shows up as "undefined." Here is the code snippet: My jQuery code snippet: $('[id^="menuitem_"]').on('click',function(){ va ...

When extracting data, I am only receiving the initial row from the database, but I specifically require the latest row that was added in the database

I am working with a JSON data structure to fetch information from a database. However, the current implementation only retrieves the first row from the database whereas I specifically need to get the most recent row that was inserted. Here is my Java clas ...

Switch out the HTML content within the JavaScript include

Here is the situation: <script type="text/javascript" src="http://xy.com/something.js"></script> This code snippet in my PHP/HTML file loads the entire something.js file. Inside that file, there are lines containing "document.write..." which ...

File appears to be empty after passing through ajax request

I have encountered an issue with my ajax submit function. When I submit the function, worklogdetailsidschedule and shift_schedule are successfully inserted into the database. However, the filename_schedule, which is a file, appears empty in the database. ...

What is the easiest method to preserve a specific dd option when submitting a form?

My webform has validation functions for each field, and if there are any validation failures when the form is submitted, the user is returned to the form with previous values in the input fields and error messages displayed. This functionality is working c ...

PHP Ajax Image Uploading and Storage

Is there a way to effortlessly upload an image and save it in the uploads folder without any page refresh? Not only that, but can we also have the uploaded image displayed on the screen within a designated div section? Unfortunately, I seem to encounter a ...