Jump to content

flyboeing

Members
  • Posts

    23
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

flyboeing's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. After making some changes the code above is working perfectly. Now all aircrafts which an airline owns are displayed in 4 columns. The aircraft is a link to the article. With this script only the aircrafts are shown when the article exists. If the article does not exist, the aircraft is not visible. This is also the part that I want to change. If an article does not exist, I would like to see the aircraft name (without the link). Can someone help me with this?
  2. Thanks Ch0cu3r, that part was missing. I also needed to change my WHERE-query, I added the search criteria that it only needs to look for 'besteld' = 0.
  3. Hello all, I have a small problem with my code. I have a table with the information regarding the fleet of aircrafts an airline has and if an airline has some aircraft on order. This table consist out of 3 columns; airline_id, aircraft_id and besteld (ordered). With my code I only get the aircraft that are in use (so where the ordered column has a value of 0). This working of me, so when an airline has no aircraft ordered, non in shown. Only the heading of the table stays visible, but I would like to see that it ain't visible any more. Where do I place my heading so it won't be visible when there are no orders? Sorry for my crappy php-coding <?php $con = mysql_connect("localhost","xxxx","xxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("deb7560n3_ai", $con); echo "<div id='huidigevloot'>Huidige vloot</div>"; // Construct our join query $query1 = " SELECT DISTINCT Airline_Aircraft.airline_id, Airlines.airline_id, Airlines.name, Airline_Aircraft.besteld, Airline_Aircraft.aircraft_id, Aircraft_id1, Aircraft.name1, d7ul5_categories.id, d7ul5_categories.path, d7ul5_content.id, d7ul5_content.title, d7ul5_content.alias, d7ul5_content.state, d7ul5_content.catid "." FROM Airline_Aircraft"." LEFT JOIN Aircraft "." ON Airline_Aircraft.aircraft_id = Aircraft.aircraft_id1 LEFT JOIN Airlines "." ON Airline_Aircraft.airline_id = Airlines.airline_id LEFT JOIN d7ul5_content "." ON Aircraft.name1 = d7ul5_content.title LEFT JOIN d7ul5_categories "." ON d7ul5_content.catid = d7ul5_categories.id WHERE "." Airlines.name = '$title_artikel' AND d7ul5_content.state = 1 ORDER BY Aircraft.name1 ASC" ; $result1 = mysql_query($query1) or die(mysql_error()); $num_rows1 = mysql_num_rows($result1); $x = 0; $num_cols = 4; echo " <table cellpadding='0' cellspacing='0' border='0' width='100%'> <tr> <td valign='top' width='25%'>"; while($row = mysql_fetch_array($result1)) { if ($row['name1'] == $row['title'] && $row['besteld'] == '0') { echo "<a href='../".$row['path']."/".$row['id']."-".$row['alias']."'>".$row['name1']."</a><p />"; } else { echo ""; } $x++; if ($x == ceil($num_rows1 / $num_cols)) { echo " </td> <td valign='top' width='25%'>"; $x = 0; } } echo " </td> </tr> </table>"; } ?> I hope someone can help me with my problem! Regards, Ruud
  4. Hello all, I have 2 tables in my database. One is with all the Airlines, the other one is a table that contains the title of an page (page title is exactly the same as the Airline name). For myself I want to make an overview of which airline I have added to my website (so where the page title = Airline name). If this page title does not match (wrong name or the page title does not exist) I want to see that (for example in red). (so if the page title = Airline name, the text is normal, does the page title not exist or typt wrong, show in red (CSS or something). So I have to compare two tables (I think), but how do I do this? I tried an if-else statement, but it will only show the entire list of page titles or only shows the else statement. I hope someone can help me with this Kind regards, Ruud
  5. Hello all, For showing data on my website I have several tables and they are linked with each other by the LEFT JOIN. The first table that I have is a table with the airline_id and aircraft_id. This table only contains numbers. Each airline (airline_id) has it's own number and this also counts for the aircraft (aircraft_id). Via a LEFT JOIN this table is linked to my Airlines and Aircraft table. In the Airline table I have the columns airline_id (this is a number) and name (the name of the airline). In my Aircraft table I have the columns aircraft_id1 (this is a number) and name1 (this one contains the name of the aircraft). This works very well. In my php script I make first a LEFT JOIN with the tables above and after that (via a LEFT JOIN) it gets the data from my content table (which contains the information about all my pages (title, alias, category, etc). The php code is working fine for me and on my website it shows all the aircraft that an airline uses (it compares the title of the webpage with the airline name to show the right aircraft). The aircraft that are shown here are linkable (so if I click on them, I go to that aircraft page). But the problem I have, I don't have a page of every aircraft (so the link is not working). So I need some kind of way to check if that article/page exists or not. If it exist it shows the <a> tags (for the link) and if it not exist, it just shows plain text (not linkable). Can someone help me with this? This is my php code: <?php $con = mysql_connect("xxxx","xxxx","xxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxx", $con); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); if ($option=="com_content" && $view=="article") { $ids = explode(':',JRequest::getString('id')); $article_id = $ids[0]; $article =& JTable::getInstance("content"); $article->load($article_id); $title_artikel = $article->get("title"); // Construct our join query $query = " SELECT DISTINCT Airline_Aircraft.airline_id, Airlines.airline_id, Airlines.name, Airline_Aircraft.aircraft_id, Aircraft_id1, Aircraft.name1, d7ul5_categories.id, d7ul5_categories.path, d7ul5_content.id, d7ul5_content.title, d7ul5_content.alias, d7ul5_content.catid "." FROM Airline_Aircraft"." LEFT JOIN Aircraft "." ON Airline_Aircraft.aircraft_id = Aircraft.aircraft_id1 LEFT JOIN Airlines "." ON Airline_Aircraft.airline_id = Airlines.airline_id LEFT JOIN d7ul5_content "." ON Aircraft.name1 = d7ul5_content.title LEFT JOIN d7ul5_categories "." ON d7ul5_content.catid = d7ul5_categories.id WHERE "." Airlines.name = '$title_artikel' ORDER BY Aircraft.name1 ASC" ; $result = mysql_query($query) or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)) { if ( d7ul5_content.title == 0 ) { echo $row['name1']."<p />"; } else { echo "<a href='../".$row['path']."/".$row['id']."-".$row['alias']."'>".$row['name1']."</a><p />"; } echo "<br />"; } } ?> I tried something, but now all the aircraft in the list ain't linkable (if non of the pages exist..).
  6. I tried several things, but I can't get it to work This is the code I use: <?php mysql_connect("xxxx", "xxxx", "xxxx") or die(mysql_error()); mysql_select_db("xxxx") or die(mysql_error()); $maand = $_GET['maand']; $jaar = $_GET['jaar']; $query = "SELECT aircraft, jaar, maatschappij,aantal, COUNT(maatschappij), COUNT(aantal) FROM deliveries_orders_boeing WHERE maand = '$maand' AND jaar = '$jaar' GROUP BY aircraft"; $result = mysql_query($query) or die(mysql_error()); // Print out result echo "<br /> <h3>Boeing deliveries ".$maand." ".$jaar."</h3><br /> <table border='0' width='700'><tr><td colspan='3'><img src='images/boeing_deliveries/".$maand."_$jaar.jpg'></td></tr><tr><td id='copyright'>© paineairport.com</td></tr> "; while($row = mysql_fetch_array($result)){ echo "<tr><td id='aircraft'>". $row['aircraft']. "</td><td id='aantal'>". $row['COUNT(maatschappij)'] ." </td> <td id='maatschappijen'><?php echo 'test'; ?>". $row['maatschappij']. "</td> </tr>"; } echo "<tr><td id='totaal'>Totaal</td><td id='totaal_aantal'> aantal ". $row['COUNT(aantal)'] ." </td><td></td></tr></table>"; ?> </td> </tr> </table> Here you can see the result: http://www.pro-aviation.nl/index.php?option=com_chronocontact&chronoformname=deliveries_orders_boeing_maand&maand=06&jaar=2011 As you can see, I only get the first airline with that aircraft. For example, On the first row you have the 737-900ER. There are 3 records in the mysql database with this aircraft and 2 airlines are using it. Only one is shown. How can I put every airline that is using the aircraft in the last column?
  7. I will try to explain. In the last column I want to show all the airlines that ordered the aircraft that is in the first cell. If you look at row 1 of secon image, you see in the first cell B737-900ER. In the column right of it, you see the amount (3 aircraft). In the last column I want to show all the airline names that ordered that type of aircraft. For example, Delta 1 aircraft and US Airways 2 aircrafts of that type, I would like to show it as "Delta, US Airways (2x)" (without the "") Here is a image: As you can see, I have a table with the delivery date (day, month, year), a column containing the airline name, an other column with the type of aicraft and another with the amount. The table below the red arrow is how I would like it to have. Showing the the type and the amount is working, but the last column, the airlines, I don't know how. As you can see, if an airline ordered more then 1 aircraft, it will gets the ..x (a number on the dots) behind the airline name (look at US Airways and KLM). I hope this will help.
  8. Thanks for the link. That solved just one of my problems, now the other one
  9. Hello all, I am making a database with all the Boeing deliveries sorted by month. I made a index with all the months and when you click on a month you will get a full list of the type and quantity of aircraft that has been deliverd. I have two problems and I can't figure it out. The first problem I have, is that I want to show the visitors which airline has bougt which type of aircraft and how many. The second problem I have is a want to show them the total amount of deliveries, not just per type of aircraft, but a total number. Here are some shots of my problem and what I have: This is how my MYSQL-database lookes like. The columns I have are: id, day, month, year, airline, aircraft, amount (just a simple translation of the Dutch words ). As you can see, there are some airlines that received one type of aircraft two times (TUI Travel PLC has received 2x Boeing 737-800). Keep this in mind, I will get back to this. This is the table on my website. The first column shows the type of aircraft. The secon column shows us how many of that type has been deliverd. In the last column I want to have all the airlines that has received that type of aircraft. As I mentioned above, TUI Travel PLC has received 2x B737-800, so in the row of B737-800 I want to have TUI Travel PLC (2x). If the airline received more then 1 aircraft, I would like to have (.....x) (and the amount on the dots --> TUI example: 2 aircraft, so 2x). So you will get TUI Travel PLC (2x). This is the code I have so far (sorry I am a real noobie in PHP/MYSQL so my programming ain't that great ) <?php mysql_connect(".....", ".....", ".....") or die(mysql_error()); mysql_select_db(".....") or die(mysql_error()); $maand = $_GET['maand']; $jaar = $_GET['jaar']; $query = "SELECT aircraft, jaar, maatschappij, COUNT(maatschappij) FROM deliveries_orders_boeing WHERE maand = '$maand' AND jaar = '$jaar' GROUP BY aircraft"; $result = mysql_query($query) or die(mysql_error()); // Print out result echo "<br /><h3>Boeing deliveries ".$maand." ".$jaar."</h3><br /> <table border='0' width='700'>"; while($row = mysql_fetch_array($result)){ echo "<tr><td id='aircraft'>". $row['aircraft']. "</td><td id='aantal'>". $row['COUNT(maatschappij)'] ."</td><td id='maatschappijen'>different companies</td></tr>"; } echo "<tr><td id='totaal'>Totaal</td><td id='totaal_aantal'>....</td><td></td></tr></table>"; ?> </td> </tr> </table> Maybe a little confusing, but I hope someone can help me with this. Kind regards, Flyboeing
  10. Hmm okay. Thank you for helping. Then I will search for an other script to show the results horizontal.
  11. Then I get: Parse error: syntax error, unexpected T_STRING in -URL-: eval()'d code on line 22
  12. Hello all, I am a little confused about the following thing. For my website I am making a php/mysql script that shows information from the DB. Normaly it is shown vertical, but I want it horizontal, just 4 at one row, than the next row. I found a piece of code and try to work with that: <?php $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); if ($option=="com_content" && $view=="article") { $ids = explode(':',JRequest::getString('id')); $article_id = $ids[0]; $article =& JTable::getInstance("content"); $article->load($article_id); } mysql_connect("localhost", "....", "...."); mysql_select_db("...."); // fetch data. I am only going to display 8 products. $res = mysql_query("SELECT file_14 FROM fotodatabase WHERE select_5 LIKE '%{$article->get("alias")}%' LIMIT 8"); $num = mysql_num_rows($res) ; // calculate table dimensions. This will display 4 products in a line and then another 4 on the next line. //If you wanted to display more products change the Limit 8 to Limit 12. $per_row = 4; $rows = (int) (($num + $per_row – 1) / $per_row); $count = 0; //Create Html table echo "<table>"; for ($i = 0; $i < $rows; $i++) { echo "\t<tr>"; for ($j = 0; $j < $per_row; $j++) { if ($count < $num) { $it = mysql_fetch_array($res); $Photo= $it["file_14"]; //I have a bike details page that i’m going to link to. I am also diplaying the bike image. The images are held in folder called ProductImages. $item1 = "<td width='160'><a href='UsedBikeDetails.php?BikeID=$BikeID'><img border='0' src='ProductImages/$Photo' width='150' height='200'></a></td>"; } else $item1 = ""; echo "\t\t<td>$item1</td>"; $count++; } echo "\t</tr>"; } echo “</table>"; ?> The first part of the code (from the top till the MySql connect) is the code to get the page Alias from Joomla. That part is working fine. Then you get the connect statement (also working), but after that I get a little confused. I changed all the parameters to my values but when I go to my URL I get: Parse error: syntax error, unexpected T_STRING in [i](URL)[/i] : eval()'d code on line 23 Can someone take a look at this code? Kind regards, Ruud
  13. Thank you for your reply pengu. I will try it with the Left Join
  14. I made a mistake in my question, it is not about 2 databases, it is 1 database with 2 tables. In the first table is de main information. The second table contains only the airport information. On my webpage only the ICAO code (4-letter) code is visible. When you hover over the 4-letter code, I want to show the compleet airport name. The hovering thing is already working for some other elements, but to get the full airport name from another table, I can't get that to work.
×
×
  • 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.