[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

PHP

120K

Solutions

33K

Contributors

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

<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 >
<TR HEIGHT=44 >
<TD WIDTH=200  ALIGN=LEFT  BGCOLOR=#FFFFFF ><FONT style=FONT-SIZE:26pt FACE="Calibri" COLOR=#404040>Apple</FONT></TD>
<TD WIDTH=669  ALIGN=LEFT  BGCOLOR=#FFFFFF ><FONT style=FONT-SIZE:26pt FACE="Calibri" COLOR=#404040>iPad 32GB/A9X/9,7&quot;/WIFI+4G/Gold with </FONT></TD>
<TD WIDTH=154  ALIGN=LEFT  BGCOLOR=#FFFFFF ><FONT style=FONT-SIZE:26pt FACE="Calibri" COLOR=#404040>Computers</FONT></TD>
<TD WIDTH=140  ALIGN=RIGHT  BGCOLOR=#FFFFFF ><FONT style=FONT-SIZE:26pt FACE="Calibri" COLOR=#404040>&#163;285.60</FONT></TD>
</TR>

Open in new window


I want to override this code with a css reference
So far I have this which is working EXCEPT for the font-size:

td>font
{
font-family: Castellar;
    font-style:italic;
    font-weight: 10;
    color: green;
    font-size: 20px;

Open in new window


Any ideas ?
1
Amazon Web Services
LVL 12
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

I have 2 db I need to pull info from but one part of the data has 2 Value that I need help formatting and displaying.

Here is my code

<?php
ini_set('display_errors', TRUE);
error_reporting(E_ALL);


//has all the info for db
    $server_cor1db01 = 'server';
    $user_cor1db01 = 'user';
    $pass_cor1db01 = 'paa';
    $database_cor1db01 = 'DB';

    $server_Vis = 'server2';
    $user_Vis = 'user';
    $pass_Vis = 'pass';
    $database_Vis = 'DB';

    $port='Port=1433'; 


//Connects to the two db
    $connection_string_cor1db01 = "DRIVER={SQL Server};SERVER=$server_cor1db01;$port;DATABASE=$database_cor1db01";

    $connection_string_Vis = "DRIVER={SQL Server};SERVER=$server_Vis;$port;DATABASE=$database_Vis";
    
    
    $conn_cor1db01 = odbc_connect($connection_string_cor1db01,$user_cor1db01,$pass_cor1db01);
    $conn_cor1db01_2 = odbc_connect($connection_string_cor1db01,$user_cor1db01,$pass_cor1db01);


//Looks to see if the db was connected 
    if ($conn_cor1db01) {
        echo "Connection established to cor1db01.<br>";
    } else{
        die("Connection could not be established to cor1db01.");
    }



    $conn_Vis = odbc_connect($connection_string_Vis,$user_Vis,$pass_Vis);

    if ($conn_Vis) {
        echo "Connection established to Vis.<br>";
    } else{
        die("Connection could not be established to Vis.<br>");
    }


//The first query

$sql_cor1db01 = "SELECT * FROM dbo.tblDimensions where [Work Order No] ='M123346'"; // the m123346 is the 

Open in new window

0
Dear Experts,
how can I download mysql table as Excel using PHP page?
I want to download the table on the database as Excel not the existing PHP page...
thank you
0
I have this code, provided by someone else:
<?php

$request = new HttpRequest();
$request->setUrl('https://api.ltl.xpo.com/rating/1.0/ratequotes');
$request->setMethod(HTTP_METH_POST);

$request->setQueryData(array(
  'format' => 'XML'
));

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'content-type' => 'application/xml',
  'authorization' => 'Bearer 5ce5e6e3304fd4e069b1c00f1c1f9bab'
));

$request->setBody('<?xml version="1.0" encoding="UTF-8"?>
<GetXpoLtlRateQuoteRqst xmlns="http://www.ltl.xpo.com/API/LTLRatingAPI">
<shipmentInfo>
    <paymentTermCd>P</paymentTermCd>
    <accessorials>
        <accessorialCd>DNC</accessorialCd>
        <accessorialCd>GUR</accessorialCd>
    </accessorials>
    <commodity>
        <grossWeight>
            <weight>500</weight>
            <weightUom>lbs</weightUom>
        </grossWeight>
        <nmfcClass>100</nmfcClass>
        <hazmatInd>false</hazmatInd>
    </commodity>
    <shipmentDate>2018-11-19</shipmentDate>
    <shipper>
        <address>
	<acctInstId>117258878</acctInstId>
            <postalCd>93727</postalCd>
        </address>
    </shipper>
    <consignee>
        <address>
            <postalCd>92027</postalCd>
        </address>
    </consignee>
</shipmentInfo>
</GetXpoLtlRateQuoteRqst>
');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

Open in new window


It fails with: Fatal error: Class 'HttpRequest' not found in /home/lakoshva/public_html/freight_test.php on line 3

Doesn't there have to be something like "require once xxxxxxxxxxxxxclass.php"?

Thanks
0
Hi,I'm having trouble trying to change the bootstrap .active class state via jquery.I've googled and found several solutions but none of them are working for me.Here is my html code:

[code]<section id="hero">
   			<div class="container-fluid">
               <div class="container">
				   <div class="row">
						<div class="col-md-12">
							<nav class="navbar navbar-toggleable-md navbar-light">
							  <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown2" aria-controls="navbarNavDropdown2" aria-expanded="false" aria-label="Toggle navigation">
								  <span class="navbar-toggler-icon"></span>
								  <span class="fas fa-times hide" data-wow-delay="2s"></span>
							  </button>
							  <a class="navbar-brand logo" href="index.php"></a>
							  <div class="collapse navbar-collapse" id="navbarNavDropdown2">
								<ul class="navbar-nav ml-auto">
								  <li class="nav-item active">
									<a class="nav-link" href="index.php">Home <span class="sr-only">(current)</span></a>
								  </li>
								  <li class="nav-item">
									<a class="nav-link" href="about.php">About Us</a>
								  </li>
								  <li class="nav-item">
									<a class="nav-link" href="howitworks.php">How it Works</a>
								  </li>
								  <?php
								  if( $_SESSION['loggedInUser'] ) { // if user is logged in
								  ?>
							      <li class="nav-item dropdown">
									<a class="nav-link" 

Open in new window

1
Hi,
I'd like to print each one of these tickets on a envelope (#10), so I would like to output a single pdf document with 4 pages, one ticket per page. I don't know if it's possible to print my HTML content on an envelope sized 9.5" x 4.125". If you look at the screenshot attached, you'll see I have all 4 tickets on a single page. I want to create a single PDF document with multiple pages, again one ticket per page.
Here is my code I have so far:
// winning tickets pdf
function fetch_data() {  
      $output = '';
      $userID = ($_SESSION["loggedInUserID"]);
      //$conn = mysqli_connect("localhost", "lormar5_wo693", "sDieYQb752KZc!;", "lormar5_wo693");  connection to theme
      $conn = mysqli_connect("localhost", "root", "root", "db_hockeypoolfundraiser");
	  $sql = "SELECT * FROM participants LIMIT 1";  
      $result = mysqli_query($conn, $sql);  
      while($row = mysqli_fetch_array($result))  
      {       
      $output .= '<tr>
	  			<td style="border-bottom: 1px solid #dfdfe0;">
				<br><br><strong>Winners Name:</strong> '.$_SESSION["participantName"].'
				<br><br><strong>First Goal Time:</strong> '.$_SESSION["firstGoalTime"].'
				<br><br><strong>Game Date:</strong> '.$_SESSION["gameDate"].' <br><br>
				</td>
				
				<td style="border-bottom: 1px solid #dfdfe0;">
				<br><br><strong>Phone:</strong> '.$_SESSION["participantPhone"].'
				<br><br><strong>Amount:</strong> $'.$_SESSION["priceFirstGoal"].'
				<br><br><strong>Player:</strong> 

Open in new window

0
I have a form/page that I'm using to book in stock based on a poNumber that generates the stock items linked to that poNumber/supplier. Currently for each line (there may be 10 items for example on order) the user needs to add qty rec'd, qty outstanding, receipted by and delivery note number in the form for each line.

I want to short cut some of the data entry by having a single entry for receipted by and delivery note number but for this to populate the rows for each entry once submitted.

The code I have at the moment is as follows: -

<div class="container">	
	<form class="form" method="post" action="transit_temp.php">	
	
	<?php
	
	$poNumber = isset($_POST['poNumber']) ? $_POST['poNumber'] : false;
	
	$poNumber = $mysqli->real_escape_string($poNumber);
	
	$index=0;

	$query = 'SELECT * FROM goodsInTrans WHERE poNumber = "'.$poNumber.'"';
			
				if (!$result = $mysqli->query($query)) {
				$err
				= "QUERY FAIL: "
				. $query
				. ' ERRNO: '
				. $mysqli->errno
				. ' ERROR: '
				. $mysqli->error
				;
				trigger_error($err, E_USER_ERROR);
				}		
	
				while ($row = $result->fetch_object())
				
				{ 

				?>
					<div class="form-group row">
						<div class=""><input type="hidden" 				class="form-control" 	name="data[<?php echo $index; ?>][supplier]" 			value="<?php echo $row->supplier ?>"/></div>
						<div class="col-xs-3"><input type="text" 		class="form-control" 	name="data[<?php echo $index; ?>][sku]"	 				value="<?php echo $row->sku 

Open in new window

0
I have a column with the following structure:
id categories title    categoryid
1	A|B|	   First	100		
2	A|B|	  second	100		
3	A|B|	   third	100		
4	A|B|	   fourth	100		
5	A|B|	   Five     100

Open in new window


I need a php code snippet which check whether all values of  categories columnn for categoryid=100 are identical or not. If all identical then print message "Same values" otherwise "Not same"
1
I need to search for an order in my WooCommerce back office by email address.  I can see the email address in wp_users but don't know how to put a name to the email address.  Is there a plugin or mysql code that will accomplish that?

Thanks,
0
Hello,
I'm working on a code that can record vocal messages and store them into a database to retrieve them later on, but my PHP script isnt working and I don't have enough expertise in web dev to correct it, can someone help me please ?
index.html
upload.php
app.js
0
Microsoft Azure 2017
LVL 12
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Dear All,

I have a device (installed on vehicle) which sends latitude and longitude on the Server through GPS. I have a route of that vehicle which is successfully plotted on Google Map.

My Problem is how can I plot latitude and longitude at runtime on Google Map in PHP dynamically on Desktop Application. I want to plot fetched latest latitude and longitude on Google Map to show where the vehicle is running.
0
This is a php script, which basically does the send mail function via terminal shell, I am studying it and the curious thing is that it worked in my tests only in the Ubuntu 14.04 versions with php5 and postfix. But I could not get it to work on Ubuntu 18.04 or Debian 9. I would like to ask for help to change the code in order to make it work in those versions. Thank you.

javali.php
1
I need a great WebHost for a site that will be using PHP and MySQL for a small project.  The site will be having users sign in, submit and edit forms.  They want to keep the history online, with frequent backups and good security.  

What a good company for professional hosting?


Thanks.
0
my view is not passing data to the controller. and i am new to codeigniter and i am confused..anyone please help

this is my view
<?php require_once(APPPATH.'views/web/header.php');?>
<?php

$ses=$this->session->userdata('webuser');
/*print_r($ses);
die;*/


?>
<style>
.select2-container {
width : auto !important;
}
.select2
{
width : 100% !important;
}
.select2-container--bootstrap
{
width : auto !important;
}
.numcolor{
color:black;
}
.backcolor{
background:#32c5d2!important;
}
.activecolor{
font-weight:bold;
}
.nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover{
	background:grey!important;
}

<?php if(strtolower($this->uri->segment(3))=="parentuser"){?>
.one{
background:#32c5d2!important;

}	
.onenumcolor{
color:black;
font-weight:bold;
}

.twonumcolor,.threenumcolor,.fournumcolor{
color:#32c5d2!important;
}
.two>a:hover{
background:black!important;

}
.three>a:hover{
background:black!important;

}
.four>a:hover{
background:black!important;


}
<?php }elseif(strtolower($this->uri->segment(3))=="student"){?>
.one,.two{
background:#32c5d2!important;
color:white;
}
.twonumcolor{
color:black;
font-weight:bold;
}
.onenumcolor{
color:white!important;

}
.threenumcolor,.fournumcolor{
color:#32c5d2!important;
}
.one>a:hover{
background:black!important;

}
.three>a:hover{
background:black!important;

}
.four>a:hover{
background:black!important;


}
<?php	}?>
				

				
</style>

<div class="page-content-wrapper">
	<!-- BEGIN CONTENT BODY -->

Open in new window

0
Hi,
I have a Table called game with 4 columns:
clock_first_goal, clock_last_goal, clock_first_penalty, clock_last_penalty

and a second Table called tickets_one with 5 columns:
clock_one, clock_two, clock_three, clock_four, clock_five
where I've imported random clock times between 0 and 20:00 minutes that of a NHL period.
There are 1200 total times (60 seconds x 20 minutes) in 5 columns so there are 240 records in this Table.

In my application I have a page called enter_games.php. What I want is when the admin submits the times for First Goal, Last Goal, First Penalty and Last Penalty, I want to check if any of these values match the values in the tickets_one Table. If they do I just want to echo "we have a match!", if not I want to echo "no match".

I'm not sure the best way to do this if it should be a Join, if statement or loop etc... I think it can be done with an if statement.
I'm somewhat new to php and mysql. This is the section of the code I'm trying to get to work:

// find matching results
// query the database with client ID
$query = "SELECT * FROM tickets_one";
$result = mysqli_query( $conn, $query );

// if result is returned
if( mysqli_num_rows($result) > 0 ) {

    // we have data!
    // set some variables
    while( $row = mysqli_fetch_assoc($result) ) {
        $time1    = $row['time_one'];
        $time2    = $row['time_two'];
        $time3    = $row['time_three'];
        $time4    = $row['time_four'];
        $time5    = 

Open in new window

0
Hi Experts,

When browsing through https://www.aces-project.com/, at times its slow.

The hosting company says its not the server, but I'm using the Appointment theme in WordPress with minor adjustments.

I've used the same theme on https://www.atsinlaw.com/ and http://www.southerntime.ca/ with a lot more adjustments, and they are faster.
0
Is it possible to use htmlspecialchars and strip_tags together? I have one paragraph that a user can edit but I just want to let them use strong tags. So, it seems overkill to try get htmlpurifier implemented in my mvc framework.

If I just use strip_tags then I am not covered for "" but using htmlspecialchars literally writes out <strong>my text here</strong>

This works fine:

<?php echo strip_tags($home->intro_text, "<strong>"); ?>

Open in new window


but if I try to do something like this:

<?php echo htmlspecialchars(strip_tags($home->intro_text, "<strong>")); ?>

Open in new window


Then the output text is back to <strong>my text here</strong>
1
when a single quote is present in data in my variables i.e. $projects_row['project_title'], $projects_row['project_detail'] then it truncate my data. These variables are receiving data from Database. I have escaped my data with addslashes and mysqli_real_escape but still data is truncated. Any solutions?

$projects_name[] = "<div class='isotope'><li class='color-shape isotope_selector ". $filter_class2."'
					id=project-id-5a01bffbcfbeb40a008b458a data-id=5a01bffbcfbeb40a008b458a>
					<span data-caticons='" . $filter_icons_all."'  data-id='" . $projects_row['id']."' data-title='" . $projects_row['project_title']."' data-detail='" . addslashes($projects_row['project_detail'])."' data-mapimage='" . $projects_row['project_image']."' data-mapgallery='" . json_encode($project_gallery_images)."'  class='li-txt' style='color:#ff0000';>
					<a id='myAnc' href='#' data-location= '".$projects_row['coords']."'>".$projects_row['project_title']."</a></span>
					<span class='thumb-container'>".$filter_icons_all."</span>			 
					</li></div>";	
					
					
echo json_encode(array("project_title"=>$project_title,"project_detail"=>$project_detail));							

Open in new window

0
I have a column in MySql table which saves multiple values in one column seperated by pipe sign:
i.e: A|B| 
B|C|E|
A|
B|E|
A|E|F|

Open in new window

                                   
Is there any way to retrieve only distinct values from the above data in PHP?

Thanks
0
OWASP: Forgery and Phishing
LVL 12
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Hi,
I'd like to find matching results between 4 columns in one table and 5 columns in another table.
I have one table called game with 4 columns:
clock_first_goal, clock_last_goal, clock_first_penalty, clock_last_penalty

and a table called participants with 5 columns:
clock_one, clock_two, clock_three, clock_four, clock_five

Everything in these columns are numbers like 4:16, 8:47, 13:02 etc clock times of a period of an NHL hockey game. I think I should be using an Inner Join for this however, it's not working, it's just displaying all of the times in the database instead of just the matching results within those columns.

Please take a look at the screen shot attached to see what I mean.

Here is the code I have so far:


$query = "SELECT * FROM participants AS p INNER JOIN game AS a ON p.game_date = a.game_date WHERE a.user_ID='$userID'";

 

$result = mysqli_query( $conn, $query );

 

                    ?>

                                                               

                                                                                <?php

                                                                                if( mysqli_num_rows($result) > 0 ) {

 

                                                                                                // we have data!

                                                                                                // output the data

 

                                             

Open in new window

0
i would like to present on a webpage some data from gsheets.

my files is at https://docs.google.com/spreadsheets/d/1iHktd327TyLslLNm1R4aLdwzf1MvWWZYCwirEZgmSxQ/edit?usp=sharing

i am after anything with todays date , and columns A,B,Cand F


i have looked at goole and to be honest got very confused
0
Hi Experts

Could you clarify if internal queries from PHP code could slow the performance of the site?

The old legacy project that I recently started to participate in extensively queries within the PHP code, users often claim there is
loss of performance

Considering queries could be optimized or not, does the data traffic in these cases between MS-SQL Server (I guess on MySQL is identical) and PHP cause this performance loss?

Thanks in advance!
1
Hi,
I have an AIX 6.1, and I need to install php 7.0.2.1 and curl 7.5.8.0.1 - it is production
I tried download the proper files but I got failed dependencies.
Would you please help me with an explanation, how it the proper way to install them correctly?
I have another test server when somebody else, I don't know who, the packages were installed and the lslpp -L|grep curl or php show well, and dependencies are missing.

see the test output checking on test AIX server:
rpm -qa|grep -i php
php-7.0.21-1
php-cli-7.0.21-1
php-common-7.0.21-1
 >rpm -qa|grep -i curl
curl-7.54.1-2
 >lslpp -L|grep -i curl
  curl                      7.54.1-2    C     R    get a file from a FTP or HTTP
 >lslpp -L|grep -i php
  php                       7.0.21-1    C     R    The PHP HTML-embedded
  php-cli                   7.0.21-1    C     R    Command-line interface for PHP
  php-common                7.0.21-1    C     R    Common files for PHP

and the errors on prod server, and if I try to install separate each failed dependencies I got more failed in deep:
>rpm -Uvh php-7.0.21-1.aix6.1.ppc.rpm php-cli-7.0.21-1.aix6.1.ppc.rpm
error: failed dependencies:
        pcre >= 7.9-2 is needed by php-7.0.21-1
        lua >= 5.1.5 is needed by php-7.0.21-1
        libxml2 >= 2.9.3-2 is needed by php-7.0.21-1
        openldap >= 2.4.40-1 is needed by php-7.0.21-1
        httpd >= 2.4.25-2 is needed by php-7.0.21-1
        libgcc >= 4.2 is needed by php-7.0.21-1
        …
0
WORDPRESS
Genesis Child Theme: Executive Pro (ExPro)
Plugin: Design Palette Pro (DPP)
Hosting: Unix (Hostgator Shared Server)
Vocabulary Terms: Page, Slug, Category, Post (Specific meanings according to Wordpress)

BACKGROUND
My site has been using Wordpress "Pages" mostly (as opposed to Posts with their corresponding Category pages). So the navigation menu consists of only Page names (and their "slugs") as the menu links.

Now, however, I am replacing the News Page with the News Category for one of those menu items. So, I want the menu link, News, to land on the Category page by that name, not the previous Page page by that name.

Previously, the News menu item was pointing to a Page called "News" and whose "slug" (or permalink) was, "/news/".
Currently, I have renamed those slugs. The News Category "slug" is simply, "news", and I renamed the News Page slug to, "/news-page/".

QUESTION
Is it possible to insert the News Category page into the main navigation menu instead of the News Page page? Please provide instructions how to do it using DPP if possible. Otherwise, I will accept child theme code modification if necessary.

I attempted to redirect the "/news-page/" slug to "/news/" in the .htaccess, but it  does not work if the category page contains too many posts that you must go to page 2 and page 3 etc. It breaks that mechanism.

In the DPP plugin, I can't find an option to do what I want. …
0
I would like to create a button on a php page that would table the records from the file on the server and load it into a mysql table.

This is a php page. It has records in the form of a table on the page. I will have the button id, the same as the file I would like to load into the mysql table. The files already reside on the server in a folder called uploaded.

Here is what I can do so far.

1. Capture the name of the file on the table with the id using jquery and ajax to push the file name to a php file that is to write the rows in the the csv file to the table.

A simple example with a field or two would be very helpful. All my fields are text as there is some characters that make the input from the csv file a little unpredictable.  

Please note the first row will have the field headings in the csv, so would need to start at row 2 and loop through the rest of the rows.
0

PHP

120K

Solutions

33K

Contributors

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.