Solved

making use of php data

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to count occurrences of each item in an array.
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.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now