PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

Share tech news, updates, or what's on your mind.

Sign up to Post

hi guys, i look after this website here and for some reason the image on the top left
is showing zoomed right in?

I dont know what is causing it to do so?

Any ideas?
Rowby Goren Makes an Impact on Screen and Online
LVL 19
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Hi Guys, i am looking after this website, and i just want to display a singular image, instead of the broken up images that are ther, however it only displays a portion of the image.

What do i need to put in so it display the full image,, the image will be about 600px width and about 900 px height here is the code that is currently there
   <div class="col-md-7">
                                    <div class="banner-img-wrapper">
                                       <div class="banner-img-wrapper">
                                        <div class="banner-img-inner">
                                            <div class="banner-img-item-1" data-swiper-parallax="-200">
                                                <div class="banner-img-1" style="background-image: url(<?php echo site_url(); ?>/wp-content/uploads/2019/11/ill1.jpg);"></div>
                                            <div class="banner-img-item-2" data-swiper-parallax="-300">
                                                <div class="banner-img-2" style="background-image: url(<?php echo site_url(); ?>/wp-content/uploads/2019/11/ill2.jpg);"></div>
                                            <div class="banner-img-item-3" data-swiper-parallax="-400">
                                                <div class="banner-img-3" style="background-image: url(<?php echo site_url();

Open in new window

It seems that my php code can't check the null value in mysql. Any ide a?

<?php if (is_null($row['rating'])) {echo "Show";} else {echo "No";}?>

Changing code from mysqli to prepared statement.


// Check if the form has been submitted:
if ($_POST['sure'] == 'Yes') { // Deactivate the record.

	    // Make the database query:
		$q = "UPDATE `users` SET `active` = '0', date_modified=NOW() WHERE id={$_SESSION['user_id']}";
		$r = @mysqli_query ($db, $q);
		if (mysqli_affected_rows($db) == 1) { // If it ran OK.
		$q = "UPDATE `notices` SET `active` = '0' WHERE users_id={$_SESSION['user_id']}";
		$r = @mysqli_query ($db, $q);
		if (mysqli_affected_rows($db) == 1) { // If it ran OK.
		echo '<p><h3a>Your membership has been deactivated.</h3a></p>';
    	//include('Deactivated.html'); // Include the HTML footer
				//exit(); // Stop the page.

		} else { // If the query did not run OK.
			echo '<p class="error">The user could not be deleted due to a system error.</p>'; 

} else { // Show the form.

	// Retrieve the user's information:
	$q = "SELECT CONCAT(username, ', ', email) FROM users WHERE id={$_SESSION['user_id']}";
	$r = @mysqli_query ($db, $q);

if (mysqli_num_rows($r) == 1) { // Valid user ID, show the form.

		// Get the user's information:
		$row = mysqli_fetch_array ($r, MYSQLI_NUM);
echo "<p><h2>Are you sure you want to deactivate your account?</h2></p>";

// Create the form:
		echo '<p><form action="CancelRenewTBR.php" method="post">
	<input type="radio" name="sure" value="Yes" /> Yes 
	<input type="radio" name="sure" 

Open in new window

Is there any code example on passing the parameter to php from JavaScript and return the result back  to Javascript ?
Any idea how to pass the field values in PHP into the fields of the modal form ?  Thx


  <title>Movie Rating</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="">
  <script src=""></script>
  <script src=""></script>
  <script src=""></script>
   <link href="./css/fontawesome.css" rel="stylesheet">
  <link href="./css/brands.css" rel="stylesheet">
  <link href="./css/solid.css" rel="stylesheet">


<div class="container">

$sql= "SELECT a.movieId, a.title, a.image_path, avg(rating) from movies a left join ratings b on a.movieId=b.movieId  ";

if (isset($_REQUEST ['submit'])) {
    if (isset($_REQUEST ['search'])){
            $search = $_REQUEST ['search'];;
            $sql = $sql . " where a.title like '%" . $search ."%'";
            $sql = $sql . " or a.releaseDate like '%" . $search ."%'";
            $sql = $sql . " or a.runningTime like '%" . $search ."%'";
            $sql = $sql . " or a.genre like '%" . $search ."%'";
            $sql = $sql . " or a.description like '%" . $search ."%'";
      $sql= $sql . " group by …
The alert message can't be faded out as expected. any idea ?

If the sql doesn't return any record, the php return an error :
"trying to get property of non-object".

How to check null recordset return in php ?

        $sql= "select * from user where userId= $id";
      $result= $mysqli->query($sql);
      if (($result->num_rows) ==1) {
I am looking at the datatables example of parent/child, and it has the server side code written in PHP to pull the data.

 Can you please explain/convert this into VB.NET or C# so I can understand how to use it with my own data?

The sites.php and users.php appear to be under the "server-side php" topics.

Editor::inst( $db, 'sites' )
        Field::inst( 'id' )->set( false ),
        Field::inst( 'name' )->validator( 'Validate::notEmpty' )
        Mjoin::inst( 'users' )
            ->link( '', '' )
                Field::inst( 'id' )
    ->process( $_POST )

Open in new window

if ( ! isset($_POST['site']) || ! is_numeric($_POST['site']) ) {
    echo json_encode( [ "data" => [] ] );
else {
    Editor::inst( $db, 'users' )
            Field::inst( 'users.first_name' ),
            Field::inst( 'users.last_name' ),
            Field::inst( '' ),
            Field::inst( '' )
                ->options( 'sites', 'id', 'name' )
                ->validator( 'Validate::dbValues' ),
            Field::inst( '' )
        ->leftJoin( 'sites', '', '=', '' )
        ->where( 'site', $_POST['site'] )

Open in new window


I have Xampp installed in Windows2012R2.
I have this error after a reboot in Xampp. I have opencart installed.  
If I change the port from 80 to 81 or other port apache starts. Any idea what could be wrong?
It seems port is used somewhere not sure where?
Announcing the Winners!
LVL 19
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

Hi All,

Please advise on the best way in a module to select query from a MSSQL db.
I have enabled ODBC etc... in PHP settings.
Have setup the DSN.
Not having much joy at all. Can query MySQL DB's of course .. but do not think I can get MSSQL to work.
Possibly I am missing an extension.

Do not want to post any code as I have tried all sorts.
I am happy with the Select.. just need to get the MSSQL connection right.

Would like to see an example I can drop into my custom extension within a module.

PHP 7.3.9
Joomla 3.9.12
Plesk 17.8.11
OS: Windows 2016.

Many thanks in advance

Is there any example on filtering a record on PHP based on certain fields such as name, description, date, etc ?


I'm trying to find a solution to replace a chain.
I tried both versions but I have the same result.

I am looking to replace "Thursday" or "Thu" by "الخميس" except that I get in all cases "الخميسrsday".
The research remains insensitive.

Can you help me please ?
$date = date("d");

$ar_f = array (
"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thurthday", "Friday", 
"Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri"

$ar_r = array (
"السبت", "الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", 
"السبت", "الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة"

echo str_ireplace($ar_f, $ar_r, strftime("%A", strtotime($date)))."<br>";
echo str_replace($ar_f, $ar_r, strftime("%A", strtotime($date)))."<br>";

Open in new window

I am recreating a page that has searches a database for medical providers three different ways. The page was originally written in and SQL. i am recreating it in PHP and MySQL. Below is the page I am recreating.

Below is the data from the database that needs to be displayed for each of the areas one can search by.

provider_physician, provider_name, provider_address, provider_city, provider_state, provider_zip, provider_phone, provider_website

Below are the three different ways one can search the database.

Method 1 - Enter the name of a physician or provider
Method 2 - Search by specialty
Method 3 - Search by city

I don't understand how to add more columns to display in my search results using jQuery. I am a novice at jQuerry and need to find out how to add an additional field. If I can understand how to add one more field, I should be able to add the rest.

Lastly, how do I get the results from Name search to display the same way the results from the specialty and city do?

I have enclosed all of my files along with the database I am pulling the results from.

Thank you in advance for your help!
I have various websites that share directories on  windows server, running PHP7.2.

The structure is:

c:\websites\\app -> Admin website
c:\websites\\clients\ -> Client A website
c:\websites\\clients\ ->  Client B website
c:\websites\\clients\ ->  Client C website

Each website has subfolders

Any scripts that are shared amongst all the folders throughout all the websites are stored in c:\websites\common and "included" where necessary

I also have a "logs" folder at

I am trying to find a way of using fwrite with an absolute path to always write any logs to the logs folder, from wherever the scripts is called from. Ideally I'd like to use something like


But I don't think that it works.

Any advice would be appreciated
Dear Experts,
I use PHP,
I need to get a result inside an object which is inside Json.
I get the parrent result like below.

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec($ch);

var_dump ( $obj = json_decode($server_output));

echo $yeniobj= ($obj->result);

//Result is 
object(stdClass)#1 (10) { ["result"]=> string(90) "{"ReturnCode":0,"ReturnData":null,"Confirm":null,"TimeStamp":"04.11.2019 10:43:34"}" ["id"]=> int(135) ["exception"]=> NULL ["status"]=> int(5) ["isCanceled"]=> bool(false) ["isCompleted"]=> bool(true) ["isCompletedSuccessfully"]=> bool(true) ["creationOptions"]=> int(0) ["asyncState"]=> NULL ["isFaulted"]=> bool(false) }

echo $yeniobj= ($obj->result);

//Result is

{"ReturnCode":0,"ReturnData":null,"PaymentConfirm":null,"TimeStamp":"04.11.2019 10:43:34"}

Open in new window

But I need to result of the ReturnCode information.
How can I get that? thank you

My environment:
AWS EC2 linux 2, apache 2.4, PHP 7.3, WinSCP (for SSH).
With AWS EC2 I have a choice of owners: root, www, ec2-user, apache
And a choice of groups: root, www, ec2-user, apache

Document root: www/html
Non-directory root which I classify as 'private' since I don't want browsers (except mine) to have access: www/private

I am the sole developer. The website is accessed by users on their browsers (vs local).

I need the following:
1. PHP to be able to create, edit and remove directories in both /html and /private.
2. PHP to read and write files in both /html and /private.
3. WinSCP (my SSH) to be able to create, edit and remove directories in /html and /private (from the browser), for development (not for world access).
4. WinSCP (my SSH) to be able to transfer, move, copy and remove files in /html and /private (from the browser), for development (not for world access).

I need help with:
Which owner:group should I give /html (and by default, its sub-directories) and why?
Which owner:group should I give /private and (and by default, its subdirectories) and why?


I am getting undefined index errors and I cant see why.

This is one of my errors
Notice: Undefined index: hall_hst in /functions.php on line 2652

this is the code.

the query does produce the proper results, the page works fine of I turn off error reporting, but I want it perfect and want the notices gone.

$query_Recordset_get_reports = "SELECT all the things";
$Recordset_get_reports = mysqli_query($link, $query_Recordset_get_reports) 
or die(header(mysqli_error($link)));
$row_Recordset_get_reports = mysqli_fetch_assoc($Recordset_get_reports);
$totalRows_Recordset_get_reports = mysqli_num_rows($Recordset_get_reports);	

	if(($taxtype == "gst") || ($taxtype == "hst")) {
			if(isset($row_Recordset_get_reports['hall_gst'])) { 
			$row_Recordset_get_reports['hall_gst'] = $row_Recordset_get_reports['hall_gst'];
			} else {$row_Recordset_get_reports['hall_gst'] = 0.00;}
			if(isset($row_Recordset_get_reports['vendor_gst'])) { 
			$row_Recordset_get_reports['vendor_gst'] = $row_Recordset_get_reports['vendor_gst'];
			} else {$row_Recordset_get_reports['vendor_gst'] = 0.00;}
			if(isset($row_Recordset_get_reports['vendor_hst'])) { 
			$row_Recordset_get_reports['vendor_hst'] = $row_Recordset_get_reports['vendor_hst'];
			} else {$row_Recordset_get_reports['vendor_hst'] = 0.00;}
			if(isset($row_Recordset_get_reports['bei_hst'])) { 
			$row_Recordset_get_reports['bei_hst'] = $row_Recordset_get_reports['bei_hst'];
			} else 

Open in new window

I have a web-based file manager system that allows users to log on and browse folders and files via a php script.

I use the google doc viewer to display the files.

My problem is that if anyone works out the URL of the file, then they could bypass the file manager system and just access the file in any browser.

Please can someone advise the best way to secure access to the files with IIS from direct URL browser access, but allow the PHP script, and the google doc viewer, to access it.
Bootstrap 4: Exploring New Features
LVL 19
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

I'm new to Laravel so forgive me if this question borders on something that should be painfully obvious...

I've downloaded a very impressive Bootstrap template for my Admin Suite.

It has a great number of features that I don't know if I'm going to need, but before I discard them completely, I wanted to make sure I wasn't overlooking something.

While the aesthetics are awesome, the functionality seems to be something that would have to come from a database of some kind. But there's nothing mentioned in the description and, I would think there should be. Even if it was a token statement that instructed developers on how to incorporate a MySQL database or something.

I probably won't use most of what's there. But I still wanted to get some other eyes on it so I wasn't overlooking something.

Bottom line: Is it assumed that there's going to be a database of some kind behind the GUI?

If so, why isn't it stated as such or am I just kind of slow?

Just wanting to make sure I'm not missing something.

Here's the URL:
Date not printing in PDF.
I have a webpage and I have added the below code. I can see in the page but when I export to PDF its not coming in the document.
  <p>Date: <span id="datetime"></span></p>
var dt = new Date();
document.getElementById("datetime").innerHTML = dt.toLocaleDateString();

Open in new window

Appreciate if you can help me print in PDF
Good morning all,

This error message does not appear all the time, I get the impression that it is when the loaded script asks for too much resources from the server that it appears.

After some research I did not find much on the subject, do you know more?

It appears on 3 codes that I have on one page:

Code 1:
<?php require_once($_SERVER['DOCUMENT_ROOT']."/includes/config.php"); ?>

<?php $Stat = $pdo->query("SELECT * FROM tb_chat_admin WHERE Public = '1' ORDER BY NumId ASC ");  while($data = $Stat->fetch(PDO::FETCH_ASSOC)){ ?>
<div>&bull; <?php echo $data["Info"]; ?><div class="div_00"></div></div>
<?php } ?>

Open in new window

Code 2:
<?php require_once($_SERVER['DOCUMENT_ROOT']."/includes/config.php"); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/includes/langue.php'); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT']."/includes/verif_user_log.php"); ?>

$Rang 		= $_SESSION["CONNECT"]["USER_LOG"]['Rang'];
$Pseudo 	= $_SESSION["CONNECT"]["USER_LOG"]['Pseudo'];
$Sexe 		= $_SESSION["CONNECT"]["USER_LOG"]['Civilite'];

$Temps 		= time();
$TempsPasse = time() - (5 * 3); //(5 * 1)  = 3 secondes

$MyPDO = $pdo->query("SELECT COUNT(*) AS nbre_entrees FROM tb_user_chat WHERE Pseudo='".$Pseudo."' "); $data = $MyPDO->fetch(PDO::FETCH_ASSOC);

	if ($data['nbre_entrees'] == 0)
		$req_fr = $pdo->prepare ("INSERT INTO tb_user_chat (Rang, Pseudo, Sexe, Timestamp) VALUES (:Rang, :Pseudo, :Sexe, :Temps)");

Open in new window

I am trying to populate a dropdown menu with data from a mysql database. I can't get the menu to populate with the provider_city column. After the menu is populated, I want to select one of the entries to have it show all the records in the database with that provider_city column. Not sure what I am doing wrong. Help is appreciated. Thank. I am including the two php files and the database file I am
A php syntax error checker I use says this:

PHP Syntax Check: Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in your code on line 17
$cancpg = "$_SESSION['choosecust']";

I don't see what is wrong with this, am I missing something. I am 99% certain this has been in the code for a long time.

Here is a broader context:

$_SESSION['blank'] = false;
	if (isset($_SESSION['narrow'])) {
		if ($_SESSION['narrow'] == "yes") {
			$cancpg = "$_SESSION['choosecust']";

Open in new window

Is there an error?
PHP PDO code to display specific items from the database. I have changed certain portions of the code to PDO and now need PDO code to actually display the data that has been fetched from the Database.

    $id = isset($_POST['id']) ? $id : false; 
if ($id) {
   $query = <<< QUERY
SELECT notices.users_id, notices.organization, notices.amount, notices.currency, notices.timeframe, notices.location, notices.description, 
FROM notices INNER JOIN users ON notices.users_id =users. id
  $stmt = $pdo->prepare($query);
  $rows = $stmt->fetchAll(PDO::FETCH_OBJ);

// Create the form:
echo '<form action="ContactPoster.php" method="post">

<p>Company: ' . $row[1] . '</p>

<p>Amount: ' . $row[2] . '</p>

<p>Currency: ' . $row[3] . '</p>
<p>Timeframe: ' . $row[4] . '</p>

<p>Location: ' . $row[5] . '</p>

<p>Description: ' . $row[6] . '</p>

<input type="hidden" name="toemail" value="'.$row[7].' " >';


Open in new window







PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.