?
Solved

making use of php data

Posted on 2011-03-11
4
Medium Priority
?
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
darren-w- earned 336 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 336 total points
ID: 35109301
0
 
LVL 10

Assisted Solution

by:Chad Smith
Chad Smith earned 164 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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
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 count occurrences of each item in an array.
Suggested Courses

801 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