I have 2 mysql tables containing data which relate to each other.
The main table contains a list of used cars and all their relevant data, ie make model price etc.
The second table contains a list of car makes and models along with a make id value and model id value for each one.
I have a script which generates an xml file using the data in the first table.
The problem is I need to take the relevant make and model id’s from the second table which correspond to each individual car and insert them into the xml file.
I can get the relevant make id to show in the xml file no problem as its a straight query as shown below:
The problems I have is the model id value. As an example the model value from the first table is SLK280. The model value from the 2nd table is SLK 280.
How can I set up a query that will see these two values as being the same and there fore output the relevant Model Id from the 2nd table?
I had tried the following but it doesn’t work:
$querymodel = “SELECT Model_Id FROM MyTable WHERE Make_Name=‘$row[Make]’ AND Model_Name LIKE ‘%$row[Model]%’”;
The values $row[Make] and $row[Model] are set previously on the page from an initial search query.
Any help would be much appreciated, thanks in advance.