...

View Full Version : Compare two fields and report



smarlar
07-20-2006, 11:49 PM
I have a simple table that I need to compare the TL fileds and produce a report only if the TL fields matches and the Status feild equals Buy and Sell.

I want to match any inventory that is the same TL and I am buying, selling, and report that from my database. I am copying a simplified version of the table as an example.

I am using PHP and MySQL as tools and cannot figure out how to comapire all the fields, as I am a rookie at best.

ID RefNo TL Status Status_Date
56 25 DryVan Sell 2006-06-21
57 25 DryVan Buy 2006-06-30

Fumigator
07-21-2006, 01:17 AM
Here's one way, probably not the best way but it works:


$query = "
select a.ID
from simple_table as a, simple_table as b
where a.TL = b.TL
and a.ID != b.ID
and status in ('Buy', 'Sell')";

smarlar
07-21-2006, 03:13 PM
I think I am following you but getting an erroe when trying.

(Parse error: parse error, unexpected T_STRING in /home/trailerr/public_html/AS.php on line 52)
Line 52 is and status in ('Buy', 'Sell')";

Here is what I did from your example;



mysql_select_db($dbname);

$result = mysql_query ('"
SELECT tractortype.TractorMake
FROM tractortype as a,tractortype as b
WHERE tractortype.TractorMake=tractortype.TracortMake
and status in ('Buy', 'Sell')");
or die("Query failed : " . mysql_error());

while ($row = mysql_fetch_assoc($result))

echo "<a class=titler>Tractors Matched</a> as of ".date("F d, Y");

echo "> $row[0] - $row[1] - $row[2] - $row[3] - $row[4] - $row[10] - $row[11]<br>";
?>

Jak-S
07-21-2006, 03:27 PM
mysql_query ('"

You've got a single quotation mark after the bracket that shouldnt be there.

smarlar
07-21-2006, 03:43 PM
That worked but not producing any information for the table. The table over 100 entires and shuld match 5 times as the TT field matches Sell with the TTfield macthes Buy.

Does the "FROM tractortype as a,tractortype as b" statment need to be modified?



<?php

// section for tractors
require_once('settings.inc');

mysql_select_db($dbname);

$result = mysql_query ("
SELECT tractortype.TT
FROM tractortype as a,tractortype as b
WHERE tractortype.TT=tractortype.TT
and status in ('Buy', 'Sell')")
or die("Query failed : " . mysql_error());

while ($row = mysql_fetch_assoc($result))

echo "<a class=titler>Tractors Matched</a> as of ".date("F d, Y");

echo "> $row[0] - $row[1] - $row[2] - $row[3] - $row[4] - $row[10] - $row[11]<br>";
?>

guelphdad
07-21-2006, 04:00 PM
smarlar, welcome to Coding Forums. Please use [ php] and [/php] tags around PHP and use [ code] and [/code] around regular mysql code. It will help your code display much nicer and easier to read. Remove the space of course.

I have added the tags in both your posts above. If you look at them you will see that even the code displays differently.

May I also offer a piece of advice. When getting help with a query always test the query directly in mysql to see if the query is working correctly. Once you know it is working correctly, then any error after that must be as a result of PHP or ColdFusion or whatever other application you run your mysql query in.

guelphdad
07-21-2006, 04:08 PM
I think the problem is that you don't understand what the aliases are doing and how to use them.

When you use an alias to refer to a table then you must refer to the table with that alias afterwards.

If TRACTORTYPE is the name of your table and you alias it as "a" and "b" then you no longer refer to the table as TRACTORTYPE but as "a" or "b".

Try your query like this:



$result = mysql_query ("
SELECT tractortype.TT
FROM tractortype as a,tractortype as b
WHERE a.TT=b.TT
and status in ('Buy', 'Sell')")
or die("Query failed : " . mysql_error());

Fumigator
07-21-2006, 04:38 PM
You're going to need this line

and a.ID != b.ID
otherwise your results set will include 1 row for every row in the table, because every row will find a match with itself.

smarlar
07-21-2006, 06:27 PM
Thanks for the input as I am getting closer after testing the SQL over and over this what I am coming up with wich returns all the records, but when I use the A.TL !=b.TL I get no results. I should have one match after looking at the database.

I am using the SELECT * because I am reporting on 6 fields not just one.


mysql_select_db($dbname);

$result = mysql_query
("SELECT *
FROM trailertype as a, trailertype as b
WHERE a.TL !=b.TL
AND Status in ('Buy', 'Sell')")
or die("Query failed : " . mysql_error());

while ($row = mysql_fetch_assoc($result))

GJay
07-21-2006, 06:33 PM
You want to be using = there, not !=.
What fumigator meant was in addition, not instead of, and should probably be < (or >) rather than !=, otherwise you'll end up with twice as many results, having both permutations (combinations? maths was so long ago).


SELECT * FROM trailertype a, trailertype b WHERE a.TL=b.TL AND status IN ('Buy','Sell') AND a.id < b.id;

Fumigator
07-23-2006, 06:42 PM
I think a join defaults to a left join only? So != would only bring back one result. I could be wrong; joins confuse me :)

I'm not sure how the < or > would work... it seems it wouldn't catch all matches. If a.ID is 3 and b.ID is 1 and their TLs match it wouldn't list it.

smarlar
07-24-2006, 08:38 PM
The table I am compairing has multiple fields but I only need to compair two fields the TL and Status

TL|Status
Dump Bed|Sell
Dump Bed|Buy
Dry Van|Sell
Wet Van|Sell
Overnight|Buy


I need to return the results "Dump Bed" as they are the only two that match both TL's and the Status is Sell and Buy. I am using MySQl version 4.0.16 if that makes a difference. Here are the results thus far.


("SELECT *
FROM trailertype
WHERE trailertype.TL=trailertype.TL
AND Status='Buy'")

Returns all records with the Status types of Buy


("SELECT *
FROM trailertype
WHERE trailertype.Status<>trailertype.Status
AND TL=TL")

Returns all records that TL that equals TL


("SELECT *
FROM trailertype a, trailertype b
WHERE a.TL =b.TL
AND Status='Buy'")
Returns nothing


("SELECT *
FROM trailertype as a, trailertype as b
WHERE a.TL !=b.TL
AND Status in ('Buy', 'Sell')")

Returns nothing

I have tired all possible combinations in My Sql admin panel and the same results are the same. Confused and dazed at this point, or do I need to copy all records to two separate databases to achieve the desired results, or do I need another variable to make this happen?

GJay
07-24-2006, 08:42 PM
Can you maybe provide a dump of your schema and some data?

smarlar
07-24-2006, 09:31 PM
Here is a dump of the table.


-- phpMyAdmin SQL Dump
-- version 2.6.4-pl2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 24, 2006 at 02:22 PM
-- Server version: 4.0.16
-- PHP Version: 4.4.1
--
-- Database: `trailerr_ats`
--

-- --------------------------------------------------------

--
-- Table structure for table `trailertype`
--

CREATE TABLE `trailertype` (
`ID` int(11) NOT NULL auto_increment,
`RefNo` int(11) NOT NULL default '0',
`CustomerName` varchar(50) default NULL,
`TL` varchar(50) NOT NULL default '',
`TLO` varchar(50) NOT NULL default '',
`TrailerLength` varchar(50) default NULL,
`TrailerLengthOther` varchar(50) default NULL,
`TrailerWidth` varchar(50) default NULL,
`TrailerRoofType` varchar(50) default NULL,
`TrailerFloor` varchar(50) default NULL,
`TrailerRearDoors` varchar(50) NOT NULL default '',
`TrailerUnitType` varchar(50) NOT NULL default '',
`TrailerLining` varchar(50) default NULL,
`TrailerInteriorOptions` varchar(50) default NULL,
`TrailerInteriorOptions1` varchar(50) NOT NULL default '',
`TrailerKingPinSetting` varchar(50) default NULL,
`TrailerSuspension` varchar(50) default NULL,
`TrailerSuspensionType` varchar(50) default NULL,
`TrailerTires` varchar(50) default NULL,
`TrailerTiresOther` varchar(50) default NULL,
`TrailerColor` varchar(50) default NULL,
`TrailerColorOther` varchar(50) NOT NULL default '',
`Date` date NOT NULL default '0000-00-00',
`Year` varchar(4) NOT NULL default '',
`Quantity` int(4) NOT NULL default '0',
`Location` varchar(5) NOT NULL default '',
`SellingPrice` float NOT NULL default '0',
`Status` varchar(20) NOT NULL default '0',
`other_` text,
`SELL_STATUS` varchar(20) default '0',
`SPrice` float default '0',
`ACost` float default '0',
`sid` float default '0',
`SComm` float default '0',
`title` text NOT NULL,
`imgdata` longblob NOT NULL,
`Status_Date` date NOT NULL default '0000-00-00',
`aYear` varchar(4) NOT NULL default '',
`aMonth` char(2) NOT NULL default '',
PRIMARY KEY (`ID`),
KEY `CustomerName` (`CustomerName`),
KEY `CustomerName_2` (`CustomerName`),
KEY `CustomerName_3` (`CustomerName`),
KEY `CustomerName_4` (`CustomerName`),
KEY `CustomerName_5` (`CustomerName`),
KEY `CustomerName_6` (`CustomerName`),
KEY `CustomerName_7` (`CustomerName`),
KEY `CustomerName_8` (`CustomerName`)
) TYPE=MyISAM AUTO_INCREMENT=97 ;

--
-- Dumping data for table `trailertype`
--

INSERT INTO `trailertype` (`ID`, `RefNo`, `CustomerName`, `TL`, `TLO`, `TrailerLength`, `TrailerLengthOther`, `TrailerWidth`, `TrailerRoofType`, `TrailerFloor`, `TrailerRearDoors`, `TrailerUnitType`, `TrailerLining`, `TrailerInteriorOptions`, `TrailerInteriorOptions1`, `TrailerKingPinSetting`, `TrailerSuspension`, `TrailerSuspensionType`, `TrailerTires`, `TrailerTiresOther`, `TrailerColor`, `TrailerColorOther`, `Date`, `Year`, `Quantity`, `Location`, `SellingPrice`, `Status`, `other_`, `SELL_STATUS`, `SPrice`, `ACost`, `sid`, `SComm`, `title`, `imgdata`, `Status_Date`, `aYear`, `aMonth`) VALUES (90, 36, NULL, 'FlatBed', '', 'NA', '', '', '', '', '', '', '', '', '', '', '', '', 'NA', '', 'NA', '', '0000-00-00', '2005', 11, 'AL', 22500, 'Sell', '', '0', 0, 0, 0, 0, '', '', '0000-00-00', '2007', '6');
INSERT INTO `trailertype` (`ID`, `RefNo`, `CustomerName`, `TL`, `TLO`, `TrailerLength`, `TrailerLengthOther`, `TrailerWidth`, `TrailerRoofType`, `TrailerFloor`, `TrailerRearDoors`, `TrailerUnitType`, `TrailerLining`, `TrailerInteriorOptions`, `TrailerInteriorOptions1`, `TrailerKingPinSetting`, `TrailerSuspension`, `TrailerSuspensionType`, `TrailerTires`, `TrailerTiresOther`, `TrailerColor`, `TrailerColorOther`, `Date`, `Year`, `Quantity`, `Location`, `SellingPrice`, `Status`, `other_`, `SELL_STATUS`, `SPrice`, `ACost`, `sid`, `SComm`, `title`, `imgdata`, `Status_Date`, `aYear`, `aMonth`) VALUES (91, 36, NULL, 'FlatBed', '', '48', '', '96', 'Aluminum', 'Laminated hardwood', 'Swing', '', '', '', '', '', '', 'Spread', 'NA', '', 'NA', '', '2006-06-30', '2005', 11, 'AL', 22500, 'Sell', '', '0', 0, 0, 0, 0, '', '', '0000-00-00', '2007', '6');
INSERT INTO `trailertype` (`ID`, `RefNo`, `CustomerName`, `TL`, `TLO`, `TrailerLength`, `TrailerLengthOther`, `TrailerWidth`, `TrailerRoofType`, `TrailerFloor`, `TrailerRearDoors`, `TrailerUnitType`, `TrailerLining`, `TrailerInteriorOptions`, `TrailerInteriorOptions1`, `TrailerKingPinSetting`, `TrailerSuspension`, `TrailerSuspensionType`, `TrailerTires`, `TrailerTiresOther`, `TrailerColor`, `TrailerColorOther`, `Date`, `Year`, `Quantity`, `Location`, `SellingPrice`, `Status`, `other_`, `SELL_STATUS`, `SPrice`, `ACost`, `sid`, `SComm`, `title`, `imgdata`, `Status_Date`, `aYear`, `aMonth`) VALUES (92, 36, NULL, 'FlatBed', '', '48', '', '96', 'Aluminum', 'Laminated hardwood', '', 'Carrier', 'Kemlite', '', 'e-Track', '42', 'Air', 'Slide', 'LP 24.5', '', 'Black', '', '2006-06-30', '2005', 11, 'AL', 22500, 'Sell', '', '0', 0, 0, 0, 0, '', '', '2006-06-30', '2007', '6');
INSERT INTO `trailertype` (`ID`, `RefNo`, `CustomerName`, `TL`, `TLO`, `TrailerLength`, `TrailerLengthOther`, `TrailerWidth`, `TrailerRoofType`, `TrailerFloor`, `TrailerRearDoors`, `TrailerUnitType`, `TrailerLining`, `TrailerInteriorOptions`, `TrailerInteriorOptions1`, `TrailerKingPinSetting`, `TrailerSuspension`, `TrailerSuspensionType`, `TrailerTires`, `TrailerTiresOther`, `TrailerColor`, `TrailerColorOther`, `Date`, `Year`, `Quantity`, `Location`, `SellingPrice`, `Status`, `other_`, `SELL_STATUS`, `SPrice`, `ACost`, `sid`, `SComm`, `title`, `imgdata`, `Status_Date`, `aYear`, `aMonth`) VALUES (93, 36, NULL, 'BellyDump', '', 'NA', '', '', '', '', '', '', '', '', '', '', '', '', 'NA', '', 'NA', '', '2006-07-24', '2000', 10, 'Multi', 0, 'Buy', '', '0', 0, 0, 0, 0, '', '', '2006-07-24', '2006', '4');
INSERT INTO `trailertype` (`ID`, `RefNo`, `CustomerName`, `TL`, `TLO`, `TrailerLength`, `TrailerLengthOther`, `TrailerWidth`, `TrailerRoofType`, `TrailerFloor`, `TrailerRearDoors`, `TrailerUnitType`, `TrailerLining`, `TrailerInteriorOptions`, `TrailerInteriorOptions1`, `TrailerKingPinSetting`, `TrailerSuspension`, `TrailerSuspensionType`, `TrailerTires`, `TrailerTiresOther`, `TrailerColor`, `TrailerColorOther`, `Date`, `Year`, `Quantity`, `Location`, `SellingPrice`, `Status`, `other_`, `SELL_STATUS`, `SPrice`, `ACost`, `sid`, `SComm`, `title`, `imgdata`, `Status_Date`, `aYear`, `aMonth`) VALUES (94, 36, NULL, 'DryVan', '', 'NA', '', '', '', '', '', '', '', '', '', '', '', '', 'NA', '', 'NA', '', '2006-07-24', '2000', 50, 'AL', 0, 'Buy', '', '0', 0, 0, 0, 0, '', '', '2006-07-24', '2006', '8');
INSERT INTO `trailertype` (`ID`, `RefNo`, `CustomerName`, `TL`, `TLO`, `TrailerLength`, `TrailerLengthOther`, `TrailerWidth`, `TrailerRoofType`, `TrailerFloor`, `TrailerRearDoors`, `TrailerUnitType`, `TrailerLining`, `TrailerInteriorOptions`, `TrailerInteriorOptions1`, `TrailerKingPinSetting`, `TrailerSuspension`, `TrailerSuspensionType`, `TrailerTires`, `TrailerTiresOther`, `TrailerColor`, `TrailerColorOther`, `Date`, `Year`, `Quantity`, `Location`, `SellingPrice`, `Status`, `other_`, `SELL_STATUS`, `SPrice`, `ACost`, `sid`, `SComm`, `title`, `imgdata`, `Status_Date`, `aYear`, `aMonth`) VALUES (96, 36, NULL, 'Grain', '', 'NA', '', '', '', '', '', '', '', '', '', '', '', 'Slide', 'NA', '', 'NA', '', '2006-07-24', '2000', 12, 'Multi', 0, 'Buy', '', '0', 0, 0, 0, 0, '', '', '2006-07-24', '2006', '4');

GJay
07-24-2006, 09:56 PM
The 'CREATE TABLE' and a handful of INSERT queries would be better, I'm far too lazy to try and do anything with that.

smarlar
07-24-2006, 10:24 PM
I have edited My post above to reflect the changes.

GJay
07-24-2006, 10:42 PM
If what has been suggested doesn't work, then I don't understand what you're trying to do.
Can you try again to explain, paying particular attention to clarity and giving complete but concise examples of what you have, and what you want to get as output?

guelphdad
07-24-2006, 10:53 PM
smarlar, you most certainly need to look into database normalization. that is a completely horrible table layout.

Here is an example of what I think you are trying to do. I'll look at your table again but am not sure this will work for you.

I have items for sale. I will give the items an id and have a status column of 'buy' and 'sell'.

What it looks like you want to do is return the items that have both buy and sell in the status field like this:

id status
36 sell
37 buy
38 buy
38 sell
39 buy
40 buy
40 sell



select
id
from testtable
where status in ('buy','sell')
group by id
having count(*) =2


that will only return the ids that have both a buy and sell in the status field.

why it won't work on your data is because it looks like you give a different id to both the buy and the sell. you don't have anything to group by that is in common to count (I have the same id for an item when it lists both the buy and sell).

I believe you will need to normalize your data before you can do the same thing.

Also why do you believe you need 8 indexes the same for customername?

smarlar
07-24-2006, 11:32 PM
First, let me say that I did not created this monster just inherited it and trying to do the best with what They have.

Ok that being said If I understand correctly then you last example is very close to what I am trying to achieve, Where you have ID I am looking to match the trailer types.

If the trailer type ”TL=flatbed" and they are selling it ”Status=Sell”, and the trailer type “TL =flatbed" and they are buying it “Status Buy” they would like to match those records and produce a report. That all I am trying to accomplish. Since all records on the trailer are stored in the same table, it has thrown me off.

I am going to de more testing with what you have listed above… Thanks

guelphdad
07-25-2006, 02:31 AM
look at the sample data you have given. how do you distinguish between the same trailer being bought and sold. They seem to have different values for the primary key, therefore there doesn't seem to be a way of you knowing that it is the same trailer.

Also if you inherit a mess, sometimes it is easier in the long run to redesign that mess into something you can work with.

smarlar
07-25-2006, 03:14 PM
I guess I need two tables to compare. One for Selling and one for Buy then compare the TL fields and display the data as the end result.

guelphdad
07-25-2006, 06:02 PM
No you don't need two tables to compare. Let me show you what I mean. Yes I am simplifying but only because that is the data you have given.

My table I have ID and trailer type and status:

56, longflatbed, buy
56, longflatbed, sell


yourtable if you have the same you have:

56, longflatbed, buy
57, longflatbed, sell

how do you know that it is the same trailer? You don't. And to me that seems to be what the problem is. I don't care how many tables you use, it looks like you can't identify a trailer as being the same one that is bought and sold whereas in my example I can because I refer to it as ID=56 in both cases.

Do you have a way of telling, from your data, which trailer is which?

smarlar
07-29-2006, 02:46 PM
The difficulty is that they may have bought 50 trailers from company A out of NYC and the trailers may be in multiple states. On the other hand they have a client B that is looking for trailers, they would put both client information into the database thus having two different ID's.

What I am trying to do is run a report from the [trailertype or tractortype] tables that would report on any trailer/tractor types(TL,TT) that match both being [Sell and Buy] (Status). Make any sense?

guelphdad
07-30-2006, 01:02 AM
Yes it would make sense but you have no way of knowing if you have that from your data.

Are you not sure of my explanation or do you not see the deficiency in your data and why you won't be able to do what you are asking?

smarlar
07-30-2006, 02:08 PM
I understand your explanation on keying off the ID, since it can't be done this away would the best thing for me to do is create a routine that would export all the data that needs to in the report into two new tables.

One table being sold, and one being bought, then compare the type fields and display that information?

Routine
Clear new tables

Get all data from trailertype that = sell export to new table
Get all data from trailertype that = buy export to new table

Compare the TL=TT fields and echo data?

Can you think of any other way?

smarlar
07-31-2006, 03:04 PM
Here is what I got thus far. I am getting all information that is status = sell then trying to insert it into a new table, which is not currently working. I know I have must have missed something.

With that said I only want to copy the data I am going to report on and not the entire table thus I am only copying a few fields within the table.

Can someone tell where I am going wrong?


// select avaiable information

mysql_select_db($dbname);

$result = mysql_query ("SELECT * FROM trailertype
WHERE Status=Sell")
or die("Query failed : " . mysql_error());

while ($row = mysql_fetch_assoc($result))

{
$RefNo=$row['ID'];
$Date=$row['Date'];
$Year=$row['year'];
$aYear=$row['aYear'];
$Type=$row['TL'];
$TypeOther=$row['TLO'];
$Quantity=$row['Quantity'];
$Length=$row['TrailerLength'];
$Suspension=$row['TrailerSuspension'];
$Price=$row['SellingPrice'];
$Location=$row['Location'];
$Status=$row['SELL_STATUS'];
}

mysql_query("INSERT INTO trailer_available
(RefNo,Date,aYear,Year,Type,TypeOther,Quantity,Length,Sspension,Price,Location,Status)
VALUES
('$_POST[RefNo]',
'$_POST[Date]',
'$_POST[aYear]',
'$_POST[Year]',
'$_POST[TL]',
'$_POST[TLO]',
'$_POST[Quantity]',
'$_POST[Length]',
'$_POST[Suspension]',
'$_POST[Price]',
'$_POST[Location]',
'$_POST[Status]')
") or die("Query failed : " . mysql_error());



Ultimately I will copy the next set of data that the status = Buy then compare the two tables indicated below.


$result = mysql_query ("SELECT *
FROM trailer_available,trailer_needed
WHERE trailer_available.Type=trailer_needed.Type")

or die("Query failed : " . mysql_error());

while ($row = mysql_fetch_assoc($result))

//Output display

{

echo "<tr bgcolor=white>
<td width=50> <a href=TrailerDetail.php?RefNo=$row[ID]> TL$row[ID] </a>
<td width=70>".$row['aYear']." ".date("F",mktime(0,0,0,$row['aMonth'],1,2005))."</td>
<td width=50> $row[Year] </td>
<td> ";
if ($row['TL']=='other') echo $row['TLO']; else echo $row['TL'];
echo "</td>
<td width=50> $row[Quantity] </td>
<td width=50> $row[Length] </td>
<td width=70> $row[TrailerSuspension] </td>
<td>$".number_format(($row['SellingPrice']+800),',')."</td>
<td width=50> $row[Location] </td>
<td width=50> $row[Status] </td>
<td> <img src=$row[imgdata] height=100px width=100px ></td>
</tr>";
}

?>

smarlar
08-01-2006, 02:53 PM
Well I alomst have it, but running into one problem. The code stops running before it can get to the include footer statement. Also it is putting my print command on top of the display. The error is Code corrupted. Insert fresh copy. at the very bottom of the display.



<?php
// clear data

mysql_query("DELETE FROM trailers_available WHERE RefNo >10")or die("Query failed : " . mysql_error());
mysql_query("DELETE FROM trailers_needed WHERE RefNo >10")or die("Query failed : " . mysql_error());


// select available information

mysql_select_db($dbname);

mysql_query ("INSERT INTO trailers_available (Refno,Date,Year,Type,TypeOther,Quantity,Length,Suspension,Price,Location,Status)
SELECT ID,Date,Year,TL,TLO,Quantity,TrailerLength,TrailerSuspension,SellingPrice,Location,SELL_STATUS
FROM trailertype
Where Status='Sell'")
or die("Query failed : " . mysql_error());


// Update trailer needed information

mysql_select_db($dbname);

mysql_query ("INSERT INTO trailers_needed (Refno,Date,Year,Type,TypeOther,Quantity,Length,Suspension,Price,Location,Status)
SELECT ID,Date,Year,TL,TLO,Quantity,TrailerLength,TrailerSuspension,SellingPrice,Location,SELL_STATUS
FROM trailertype
Where Status='Buy'")
or die("Query failed : " . mysql_error());

// Display data


$result = mysql_query ("SELECT *
FROM trailers_needed,trailers_available
WHERE trailers_needed.Type=trailers_available.Type")

or die("Query failed : " . mysql_error());

while ($row = mysql_fetch_assoc($result))

//Output display

{

echo "<tr bgcolor=white>
<td width=50> <a href=TrailerDetail.php?RefNo=$row[RefNo]> TL$row[RefNo] </a>
<td width=70> $row[Date] </td>
<td width=50> $row[Year] </td>
<td> ";
if ($row['Type']=='other') echo $row['TypeOther']; else echo $row['Type'];
echo "</td>
<td width=50> $row[Quantity] </td>
<td width=50> $row[Length] </td>
<td width=70> $row[Suspension] </td>
<td>$".number_format(($row['Price']+800),',')."</td>
<td width=50> $row[Location] </td>
<td width=50> ".$status["$row[Status]"]." </td>
<td> <img src=$row[imgdata] height=100px width=100px ></td>
</tr>";
}

?>

<center><br>
<input type=button name="Update" value="Print" class=TxtBut onClick="window.print()">&nbsp;&nbsp;&nbsp;
<input type=submit name="Update" value="Home" class=TxtBut>
</form>
<br></center>

<?php include ('logo_footer.php');?>

Fumigator
08-01-2006, 03:34 PM
The error is Code corrupted. Insert fresh copy. at the very bottom of the display.

You lost me....

Maybe you can post the source code of the browser page, that might help. Or just explain what kind of error you're getting...

smarlar
08-01-2006, 03:46 PM
Here is a screen capture of the page, look at the bottom for the error I highlighted in blue.

http://marlar.biz/Photos/error%20sort.png

smarlar
08-01-2006, 10:35 PM
Got the error figured out now I am down to why the print and home key are showing up top when the code clealy put's it below the php...?

guelphdad
08-01-2006, 11:03 PM
You don't have a <table> and </table> in your code above. If you have the </table> in the wrong spot it is possible for your print/home links to show up above your table.

smarlar
08-01-2006, 11:05 PM
I found it, a rookie mistake I did not close all my tables all the way.

Thanks for all your help on this one, I have one last page that I am working on and just might need your help again.

I will go threw it repeatedly before I post this one.

Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum