Jump to content

physx

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

physx's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am using PHP and MSSQL. (Latest Versions) Basically, im pulling from the db a list of suppliers(Limo companies) that offer discounts(based on vehicle type). The result of the query is exactly what i'm asking for, although if a supplier is offering 3 discounts (1 discount for each of the vehicle types he owns) i get three rows (duh).. This causes me havok when using php/html to format the results because I dontwant to list the supplier 3 separate times.. i want tolist him once, but then indicate he has three vehicle types that are discounted. Here is my query: SELECT [clr].[dbo].[supplier].[supplierId] ,CAST([Company] AS varchar) AS [Company] ,CAST([HOCity] AS varchar) AS [HOCity] ,CAST([HOState] AS varchar) AS [HOState] ,CAST([HOPin] AS varchar) AS [HOPin] ,[Discount] ,CAST([CompanyDescription] AS varchar(max))AS [CompanyDescription] ,[startDate] ,[EndDate] ,[baseHrRate] ,[isPercentage] ,[DiscountHrRate] ,[geoImg] ,[clr].[dbo].[VehicleTypes].[VehicleTypeId] ,CAST([TypeName]AS varchar)AS [TypeName] ,[Capacity] FROM [clr].[dbo].[supplier] INNER JOIN [clr].[dbo].[supplierVehicles] ON [clr].[dbo].[supplier].[supplierId] = [clr].[dbo].[supplierVehicles].[supplierId] INNER JOIN [clr].[dbo].[supplierVehicleHourlyServiceRateDiscounts] ON [clr].[dbo].[supplierVehicleHourlyServiceRateDiscounts].[supplierVehicleId] = [clr].[dbo].[supplierVehicles].[supplierVehicleId] INNER JOIN [clr].[dbo].[VehicleTypes] ON [clr].[dbo].[VehicleTypes].[VehicleTypeId]=[clr].[dbo].[supplierVehicles].[VehicleTypeId] WHERE IsDeleted = 0 AND [HOCity] = '$cids' AND CURRENT_TIMESTAMP < [EndDate] ORDER BY [Company] DESC, [TypeName] ASC Here is my php/html to display results: $suppliers = mssql_query($supplierQuery) or die("You're Query is an Epic Failure". 'MSSQL error: ' . mssql_get_last_message()); while($supplier = mssql_fetch_array($suppliers)){ $company = $supplier['Company']; $percentage = $supplier['Discount']; $type = $supplier['TypeName']; $img = $supplier['geoImg']; $companyDesc = $supplier['CompanyDescription']; echo "<div class=\"mini_deal_card\">"; echo "<div class=\"mini-card hotel 223203\">"; echo "<div class=\"right\">"; echo "<div class=\"redtag\">"; echo "<span class=\"price\">$59</span></div>"; echo "</div><div class=\"left\">"; echo " <a href=\"#\"><img src=\"/images/sm/" . $img . ".gif\" class=\"hotel-thumb\" alt=\"New York Limo Deals\"></a>"; echo "<p class=\"name\">" . $company . " </p>"; echo "<p class=\"hotel\">Save Up to " . $percentage . " % for your next " . $type . " Service</p>"; echo "<p></p>"; echo "<br class=\"clear-right\"> </div></div></div>"; } Can anyone suggest a way to list the data better?
  2. First of all, here is what I'm running: MySQL: 5.0.81 PHP: 5.2.9 Here is what I am handling: * I have a list of possible service categories (A/C repair, Janitorial... etc... about 272) * For each category, there are several vendors that perform that particular service. * I have a list of customers that will use these various services * Each customer is assigned a "zone #" that describes their geographic location * Each vendor can serve multiple zones and multiple categories, and any combination. What is the best way to set the vendor tables up, to allow for the multiple category associations and multiple zones it can service? Example: Vendor A offers Painting and a/c repair services. This vendor offers his Painting service for Santa Monica, CA (zone 6 ) AND Pasadena, CA (zone 8 ),BUT he offers his a/c repair service ONLY to Pasadena, CA (zone 8 ).... Please help... I am relatively new to mysql. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.