Solved

making use of php data

Posted on 2011-03-11
4
197 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 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