Articles & Videos



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

If $_SERVER vars are an array, what would the code look like to access each var such as 'REQUEST_TIME'?
PeopleSoft Has Never Been Easier
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

I added codeigniter 'table' to my project and i got desired outcome for view except for the fact that the way i had it before i was able to delete record by clicking on them since they were anchor tags, i would like to know how to recreate this in new table format. Thanks!
I am struggling to convert a date that I use as part of a filename of a zip file. At the moment it prints
but I need to have it print

I have posted the code I am using and would be grateful if someone could help with this. Thanks


case 'backupfile':
    echo    $_POST['db'].'_'.date($dateformat, time());					

Open in new window

I have downloaded and installed wamp on my system but I can't connect to phpmyadmin though I write "localhost/phpmyadmin" in the url.
I really need your helps .
See my below code.

$query_rs_media_new_group = "SELECT supplier_code, title, url, description, description_item, brand, type, weight, category, section, width, label_artwork, min(id) as id 
							 FROM media_new 
							 WHERE media_binder = '1'
							 GROUP BY title 
							 ORDER BY brand";
$rs_media_new_group = mysql_query($query_rs_media_new_group, $conn_cmyuk) or die(mysql_error());
$row_rs_media_new_group = mysql_fetch_assoc($rs_media_new_group);
$totalRows_rs_media_new_group = mysql_num_rows($rs_media_new_group);

Open in new window

The order by brand is not coming out in the correct order. Could this be something to do with the alias or group by?

I'm using PHP and dblib to connect tp a MS SQL server data base, i can connect and talk to the database fine but I'm finding it hard to pull a single row of data or a single entry

$con = new PDO("dblib:host=****;dbname=nursery",'pcbuddy','****');

Open in new window

foreach($_POST['selectedinvoices'] as $ids)
				$query_today = $con->prepare("SELECT * FROM Invoices WHERE invoice_no = :ID");
				$query_today->bindParam(':ID', $ids, PDO::PARAM_INT);
				echo $stmt["invoice_no"];

Open in new window

No matter what I try I cant do a single select query.

Please help
We have an app that detects if the device is a smart phone or tablet (vs. computer) and redirects accordingly to the "phone" version of the main page. It does that using this php code:

$loc = "form.php";
if(! empty($_SERVER['HTTP_USER_AGENT'])){
		$useragent = $_SERVER['HTTP_USER_AGENT'];
		if( preg_match('@(iPad|iPod|iPhone|Android|BlackBerry|SymbianOS|SCH-M\d+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS)@', $useragent) ){
			$loc = "phone.php";
//echo "city tester no = " . $_SESSION['city_tester_no'] . "<br>";
//echo "loc = " . $loc . "<br>";	
header("Location: " . $loc);

Open in new window

Until recently (last week?) this worked perfectly in all cases (to my knowledge).

Today, for my main customer, it goes to form.php when he accesses it from his iPhone 6.

When I access from my iPhone 6, it behaves in the desired way; goes to phone.php.

Why would this change?

Hi All,

I have written a script to grab the most common words in a page (with tags stripped etc.) It mostly works, however there is an occasional occurrence of the following happening: helloThisIsAnExampleOfTheAnomoly.

This occurs while grabbing certain HTML via a cURL based function, stripping tags and counting word frequency. It mostly appears to occur in menus and widgets.

What I'm looking for is an elegant/efficient solution to pop/push/unset values in the array with the values split.

To expand:
preg_replace('/(?<! )(?<!^)[A-Z]/',' $0', $words)

Open in new window

I'm using the above regular expressions to essentially split the values based on uppercase values occurring mid string/array element.

To summarise:
$array is currently something like this: ("This", "is", "okay", "this", "IsNotOkay")
What I want:
$array is going to look something like this ("This", "is", "okay", "this", "Is", "Not", "Okay")

Don't worry too much about the repeat values as I am utilising a "stop words" array to rid the ones I would not like to keep.

I've not got it working nicely yet so thought I'd turn to you for your expert input.

Thanks in advance.
hi experts,

I have some html code and css3 animation for an alert box to pop up with an error for my email validation in php.

However I need to make the white cross on each box clickable and also make them disappear when clicked.

im nit sure how to do this in js and im not even sure if it can be embedded directly into php??

Thanks please see code below.


function validation_errors($error_message){ //Function for displaying validation errors

// HTML & CSS Alert Box
$error_message = <<< EOS

body {
	height: 100%;

.container {
	display: flex;
	height: 10%;
	justify-content: center;
	align-items: center;

.rectangle {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	positon: relative;
	width: 50px;
	height: 50px;
	background: #e74c3c;
	transform: scale(0);
	border-radius: 50%;
	color: white;
    margin-bottom: 10px; 
	opacity: 0;
	overflow: hidden;
	animation: scale-in .3s ease-out forwards,
		expand .35s .25s ease-out forwards;

.notification-text {
	display: flex;
	align-items: center;
	padding: 0 16px;
	font-family: 'Roboto', sans-serif;
	font-size: 14px;
	animation: fade-in .65s ease-in forwards;

@keyframes scale-in {
	100% {
		transform: scale(1);
		opacity: 1;

@keyframes expand {
	50% {
		width: 350px;
		border-radius: 6px;
	100% {
		width: 414px;
        height: 40px;
		border-radius: 4px;
		box-shadow: 0px 1px 3px 0px rgba(0,0,0,.2),
								0px 1px 1px 0px rgba(0,0,0,.14),

Open in new window

Hi experts.

I am coding a login system, However when I submit a registration form it just won't save the data into the database. im sure all my code is valid and can't seem to find the reason why??

no error messages are displayed and I have tested connection to the database and it connects fine.

I have set some code to echo "USER REGISTERED" if the data was submitted and stored in the database successfully but I can't get that message to show so there must be something im missing.

Please see code below, If you have any suggestions or spot any errors please let me know. Thanks.



// includes original html for login page

$sql = "select * from users"; // Pull user info from Database.
$result = query($sql);
$row = fetch_array($result);

echo $row['username']; // Get username from database.


Open in new window



// includes original html for Create Account page


Open in new window


<?php include("functions/init.php"); // includes all code for login  

<!DOCTYPE html>
Copyright (C) Mike Z Moore - All Rights Reserved
Unauthorized copying of this file, via any medium is 

Open in new window

MS Dynamics Made Instantly Simpler
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

I have started gettin this error  from some of the emails I have sent.
Some emails are being delivered but some fails, any ideas?
I use phpmailer to send emails.

SMTP error from remote mail server after end of data: 550 5.7.1 You are only allowed to send 200 bulk messages per 8 hours, try later
I have mysql table named "sheet" and column name is "cep" which is varchar (50)

I want to add "0" as a prefix to the "cep" which reserves mobile numbers for me,

what is the correct mysql statement for that?

what I want to do is to concatenate "0" + "cep column" with a mysql

how can I do that?
Hi -
I have a table with time card type data -
I need help creating a trigger for two specific fields in the table (start_time, end_time) that will not allow the fields to be updated once they have values in them -
The process is that a 'record' is inserted into the table for a specific task with empty start and stop datetime fields -
The start and stop fields are updated using a form when the task is started and finished -
I do not want the user to be able to use the form again to 'change' the start and finished times -

This is my first attempt at creating a trigger and I have spent way too many hours trying to figure out how to make this work :-)

Any and all help gratefully appreciated -
Dear Experts,

I use strtoupper function but it doesn't work on some characters. The output of below code is :  ğüöçşıWR

what do you suggest I should do?

<!doctype html>
<meta charset="utf-8">


$myname= "ğüöçşıwr";
echo $myname = strtoupper($myname);



Open in new window


I have been playing with the following
from within a PHP app.

So far so good: I am able to show data coming from a PHP function (selecting data from a MySQL DB) and also able to export in JSON format to allow the chart to showup, but ...

...I find no way to change tooltip data, or simply change duration format (it seems I cannot decide a fixed format like h m s instead of the default by day).

The data I am using to feed the chart include hours, minutes and seconds

Anyone who has experience on this can confirm if:
 1 - It is possible to change duration format and how
 2 - It is possible to change tooltip content/format and how

Thanks in advance
Hi Experts

Could you point the correct way to format a MySQL query to obtain data between 02 dates accordingly to:
What I tryed with no success:

SELECT DATE_FORMAT(_updated,'%Y-%m-%d %h-%p') as _datetime, _number, _callback, _causeid FROM meeta_callback.incomingcall_history where _updated between '2017/06/01 12:00 00:00:00' and '2017/06/14 12:00 23:59:59' order by DATE_FORMAT(_updated,'%Y-%m-%d %h-%p'),_callback

Open in new window

Thanks in advance!
Here's a screenshot of my page:

The problem is the unexplained white space to the left of the "Personal Health Survey" link.

Here's the PHP that's generating this mess:

    $out .= '<br><b<span style="color: #910028; font-weight:bold; font-size:12pt;">Personal Health Survey</span>';
    $out .= "<br><br><a href='{$survey_guid}'>Take your Personal Health Survey</a>";
    echo $out;

Open in new window

There's a distance of 10-15 spaces to the left of the "Take your personal Health Survey" link and I don't know how to get rid of it.


I'm trying to use the following php to post multiple rows from a form to a table via an insert query ...

if ((isset($_POST['submit1']))
			&& (!empty($_POST['supplier']))
            && (!empty($_POST['sku']))
            && (!empty($_POST['unitsRequired']))
			&& (!empty($_POST['unitsReceived']))
			&& (!empty($_POST['receipt']))


	    $supplier 			= $mysqli->real_escape_string($_POST['supplier']);
            $SKU 				= $mysqli->real_escape_string($_POST['sku']);
            $unitsRequired 	= $mysqli->real_escape_string($_POST['unitsRequired']);
	   $unitsReceived 		= $mysqli->real_escape_string($_POST['unitsReceived']);
	   $receiptedBy 		= $mysqli->real_escape_string($_POST['receipt']);
            $sql = "INSERT INTO goodsIn (supplier, SKU, unitsRequired, qtyReceived, receiptedBy) VALUES ('$supplier', '$SKU', '$unitsRequired', '$unitsReceived', '$receiptedBy')";
            if (!$res = $mysqli->query($sql)) trigger_error( $mysqli->error, E_USER_ERROR );


Open in new window

The php only runs when the results in the form (this varies depending on the search criteria which produces the form) contain 1 row of data when 2 or more are present the process fails.

Where do I introduce a while loop in the code to accomodate this?

Hope this makes sense?

I'd like to create a temporary table that has random numbers in the name, then insert records to it.  Once I'm done, I'll delete the temporary table.  Creating the table works fine, but when I go to insert, I can't use a variable for the table name.  Here's a code snipit...
			$query = $qry_reg_insert->prepare('INSERT INTO {$temp_table} (

Open in new window

I've also tried 'INSERT INTO $temp_table(

I'm creating the temporary table with random numbers so another user doesn't come along at the same time and insert more records into the same table.  I don't see any way to do it without using a variable inside the  Insert statement.

Any thoughts?


Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I have 4 tabs in bootstrap, and each tab has a pagination system.

The problem is when you are on anything other than the default tab and click next page, it reverts back to the first tab.

I am looking for a way to identify which active tab its on currently and pass that along so it doesnt keep reverting to the default tab.

I am not sure how to identify which tab is active and pass the value along.

I can provide more detailed code if needed but basically the question is how to structure my code to find the currently active tab in bootstrap and maintain that tab when the page is reloaded (in this case when the user clicks next page or last page).

Here's my code:

function verifySSN(Array $params)
	 global $CN;
	 echo $usrSSN;
	 echo "<br>";
	 echo $usrDOB;
	 echo "<br>";
	 echo $empPID;
	$sql =$CN->prepare("SELECT
	FROM hraUsers U INNER JOIN Employers E O
	N U.empID = E.empID 
	INNER JOIN ChannelPartners CP 
	ON E.cpID = CP.cpID 
	AND U.usrDOB=:usrDOB
	AND E.empID=:empID");
	$sql->bindValue(':usrSSN', $usrSSN, PDO::PARAM_STR);
	$sql->bindValue(':usrDOB', $usrDOB, PDO::PARAM_STR);
	$sql->bindValue(':empPID', $empPID, PDO::PARAM_INT);

Open in new window

Here's the error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined' in D:\www\\api_test.php:71 Stack trace: #0 D:\www\\api_test.php(71): PDOStatement->bindValue(':empPID', '873', 2) #1 D:\www\\api_test.php(3): verifySSN(Array) #2 {main} thrown in D:\www\\api_test.php on line 71

Line 71 is this: $sql->bindValue(':empPID', $empPID, PDO::PARAM_INT);

I don't understand how it can't "see" the value, when I can print it above.

Any ideas?
I want a tool that will run through our website once daily and send a report of any broken links it finds. I can do it either in VB and use Access 2003 here at the office or I can install it as a php app on our  web server.

Any ideas?
I have a login page, the session variables appear to be set on the login page (I echoed them all back) but when I get to the next page I get  the undefined index error for all of the session variables.
array(0) { } session started

Notice: Undefined index: USERID in D:\Hosting\11817446\html\xxxN\index.php on line 12

Notice: Undefined index: PASSWORD in D:\Hosting\11817446\html\xxx\index.php on line 13

Notice: Undefined index: FNAME in D:\Hosting\11817446\html\xxx\index.php on line 14.

Here is the code from the login page:
// Create and execute the query to get the user's information from the database
$sql = "SELECT * FROM users WHERE UserID = '$username' AND UserPW = '$password'";

$result = mysql_query($sql);

$user_data = mysql_fetch_array($result);
    $numrows = mysql_num_rows($result);
//echo "line 45" .$sql . "";
    if ($numrows == 1)
	// This is a successful login.  Populate session variables.
	//$arr = mssql_fetch_array($result, MSSQL_ASSOC);

	$_SESSION["USERID"] = $user_data["UserID"];
	$_SESSION["PASSWORD"] = $user_data["UserPW"];
	$_SESSION["FNAME"] = $user_data["FName"];
	$_SESSION["LNAME"] = $user_data["LName"];
	$_SESSION["TITLE"] = $user_data["JobTitle"];
	//echo "login" .$_SESSION['FNAME']."" ;

	header("Location: index.php");
	$_SESSION['errorMsg'] = "Username or Password invalid.";
	//header("Location: index.php");
	echo "line 61";

Open in new window

And here is the portion of code from the receiving page where I tried to view the session variables
echo "session started" ."<br />";

if (isset($_SESSION['USERID'])){
	echo "user is not logged in";}
echo $_SESSION["FNAME"];  

Open in new window

    $out = <<<OUT
	<form method="post">
		<input type="hidden" name="usrID" id="usrID" value="{{usrID}}"> <input type="hidden" name="usrFN"
			id="usrFN" value="{{usrFN}}"> <input
			type="hidden" name="usrLN" id="usrLN" value="{{usrLN}}"> <input type="hidden"
			name="usrVerified" id="usrVerified" value="{{usrVerified}}">
	<h4 style="margin:5px 0;">Is this You?</h4>
	{{usrFN}} {{usrLN}} <br> {{usrCity}} {{usrState}}, {{usrZip}} <br>

	<div class="btnConfirmWrap" style="margin-top:5px;">
		<input class="btnConfirmYes" type="button" name="verifyUseryes" id="verifyUseryes" value="Yes" style="width: 60px">
		<input class="btnConfirmNo"  type="button" name="verifyUser" id="verifyUserno" value="No" style="width: 60px">

Open in new window

What is "<<<OUT"?

I've tried googling this thing and I don't know if I'm searching for the wrong thing, but I keep coming up empty.

What is it?
Hi experts i am testing the email features in SQL and have a basic one working to email directly to myself. What I am attempting to do is execute this query from PHP (I'd rather not use the php mail function, which is why I'm looking into the SQL mail function). Below is the sql query I am using to send an e-mail.
USE msdb
EXEC sp_send_dbmail @profile_name='airelay',
@subject='test message',
@body='test email'

Open in new window

basically I am trying to execute this query after submit on a php form. Any suggestion on how I can perform this? All other options suggest to use the php mail function.





Articles & Videos



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.