Solved

making use of php data

Posted on 2011-03-11
4
201 Views
Last Modified: 2012-05-11
Hi
I have a php query against mysql that returns two fields from a delivery database - print and route.
These I can get to display in a table - per attached code.
However I need to be able to manipulate the data - specifically concatanate the two fields (converting the print to string). This is because there is a delivery note in pdf that is made up of these two fields concatanated. ie 'printroute.pdf'. If I can get this I can print the delivery note simply by calling that order .
Can php do this?

Thanks!
<?php
?>
<html>
<head><title>Schedule</title></head>
<body background="cream.jpg">

<link rel="stylesheet" href="schedule.css" type-"text/css">
<?php
  $user="clayton";
  $host="localhost";
  $password="******";
  $database = "******";
  $cxn = mysqli_connect($host,$user,$password,$database)
         or die ("couldn't connect to server");
  $query = "SELECT print, route FROM DELARCH WHERE orderno = 742695";
  $result = mysqli_query($cxn,$query)
            or die ("Couldn't execute query.");


  /* Display results in a table */
  {
   /* Display results */
     echo "<table border='1'><thead><tr>";
     $finfo = mysqli_fetch_fields($result);
     foreach($finfo as $field)
     {
        echo "<th>".$field->name."</th>";
     }
     echo "</tr></thead>
           <tbody>";
     for ($i=0;$i < mysqli_num_rows($result);$i++)
     {
        echo "<tr>";
        $row = mysqli_fetch_row($result);
        foreach($row as $value)
        {
           echo "<td>".$value."</td>";
        }
        echo "</tr>";
     }
     echo "</tbody></table>";


  } 

?>
</html>

Open in new window

0
Comment
Question by:ClaytonGlass
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
darren-w- earned 84 total points
ID: 35109291
You concatenate using the period "."

Concatenating a string:

$filename = $route.$print.".pdf";
0
 
LVL 13

Assisted Solution

by:darren-w-
darren-w- earned 84 total points
ID: 35109301
0
 
LVL 10

Assisted Solution

by:Chad Smith
Chad Smith earned 41 total points
ID: 35109316

$row = mysqli_fetch_row($result);
           echo "<td>".$row["print"].$row["route"]."pdf</td>";
        echo "</tr>";

Open in new window

0
 

Author Closing Comment

by:ClaytonGlass
ID: 35109357
Thanks to you all for prompt answers!
IMore than enough to get me there..thanks again!
0

Featured Post

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress Pagination 1 46
Wordpress Query 5 47
How do I Enable submit button only if listbox has items 4 35
CSRF session and form tokens never match when using php/AJAX 4 31
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question