Jump to content

All Activity

This stream auto-updates     

  1. Yesterday
  2. benanamen

    Submit large form created with select statement

    I will give you a clue. When you submit a form you get an array. The array has keys and values. You can loop over an array and do something with the keys and values.
  3. Hi, I have a very large form that has been created with a select statement. When i am submitting the form and running the sql insert, i obviously cant list out all of the fields like you would for a small form. How would one go about submitting a form with a large number of fields. The code below is one of the lines of the table <tr> <td style="width:70%;"> <span value="1">Item</span> </td> <td class="text-center"> <input class="eqQty text-center up" type="text"> </td> </tr> I am sure that the answer is faily simple but googling has not been friendly to me on this one. Kind Regards
  4. Adamhumbug

    Move tr to top of table if input changed

    I have found what feels like quite a nasty way of doing what i wanted. $('#equipmentTable input.eqQty').focusout(function() { var row = $(this).closest('tr'); if ($(this).hasClass('up')) row.insertBefore( row.parent().find('tr:first-child') ) .find('label').html('move to bottom'); else row.next().after(row); });
  5. Hi all, I have a table that is being created with a select statement. It has 3 tds, the third being a text box. When the user fills in the textbox i would like it to go to the top of the table. I have found some code that uses checkboxes but as i am very new to js and jq i would really appreciate help on this. I would prefer this to be written in js as i understand it better. The code that i found is below and i have tried to modify it do what i want without any joy. $('table').on('change', '[type=checkbox]', function () { var $this = $(this); var row = $this.closest('tr'); if ( $this.prop('checked') ){ // move to top row.insertBefore( row.parent().find('tr:first-child') ) .find('label').html('move to bottom'); } else { // move to bottom row.insertAfter( row.parent().find('tr:last-child') ) .find('label').html('move to top'); } }); I would appreciate any help with this. Kind Regards
  6. Barand

    PHP in CSS with SQL and Sessions

    Here's an optional version - less than 60% (red) over 80% (green) function bar($wid, $ht, $val, $max=100) { $bar = "<svg width='$wid' height='$ht' viewBox='0 0 $wid $ht'>\n <defs> <linearGradient id='pchi' x1='0' y1='0' x2='0' y2='1'> <stop offset='0%' stop-color='#54BC54'/> <stop offset='15%' stop-color='#eee'/> <stop offset='100%' stop-color='#0B7604'/> </lineargradient> <linearGradient id='pclo' x1='0' y1='0' x2='0' y2='1'> <stop offset='0%' stop-color='#E02222'/> <stop offset='15%' stop-color='#eee'/> <stop offset='100%' stop-color='#A91723'/> </lineargradient> <linearGradient id='pcmid' x1='0' y1='0' x2='0' y2='1'> <stop offset='0%' stop-color='#F2D335'/> <stop offset='15%' stop-color='#eee'/> <stop offset='100%' stop-color='#EC9807'/> </lineargradient> </defs> "; $pix = $wid/$max; if ($val > 100) $val = 100; // percentage labels for ($p=25; $p<=75; $p+=25) { $ty=8; $tx = $p * $pix; $bar .= "<path d='M $tx $ty l 0 4' stroke='#AAA' /> <text x='$tx' y='$ty' class='pcent' >{$p}%</text>\n"; } // draw bar $w = $val * $pix; $h = $ht-12; if ($val > 80) $barfill = 'url(#pchi)'; elseif ($val > 60) $barfill = 'url(#pcmid)'; else $barfill = 'url(#pclo)'; $bar .= "<rect x='0' y='12' width='$wid' height='$h' stroke='#444' fill='#DDD' />\n"; $bar .= "<rect x='0' y='12' width='$w' height='$h' fill='$barfill' />\n"; $bar .= "</svg>\n"; return $bar; }
  7. Cobra23

    PHP in CSS with SQL and Sessions

    Thank you Barand. I will make a test with it and compare on my preference
  8. ianhaney

    display data in two columns bootstrap

    No am not using Wordpress
  9. Cobra23

    display data in two columns bootstrap

    Are you using Wordpress by any chance? I asked because you mentioned a blog
  10. mac_gyver

    display data in two columns bootstrap

    before the start of your html document, query for and retrieve the data you want in the order that you want it, storing the two rows of data in an appropriately named php array variable. loop over the data at the point in your html document where you want to display the content and output the dynamic parts using php code.
  11. I have a blog on my website and the blogs content is stored in a database. On my home page I have the two recent articles displayed on my home page but I have to change them manually so I add the recent article on the home page in the first column and the second most recent one in the next column so they are side by side. What I want to do is automatically display the blogs image and blog title from the database and display on the home page so I don't have to keep changing it manually My current code looks like the following <div class="block"> <div class="container"> <h3 class="text-center"><span class="color">Recent Blog Articles</span></h3> <div class="row"> <div class="col-md-6"> <div class="text-img animation" data-animation="fadeInLeft" data-animation-delay="0.5s"> <a href="https://www.it-doneright.co.uk/blog/one-year-to-go-until-end-of-support-for-windows-7"> <div class="image"> <img class="img-responsive" src="https://www.it-doneright.co.uk/images/blog/windows7-eos-new.jpg" alt="One year to go until end of support for Windows 7"> </div> <p>One year to go until end of support for Windows 7</p> </a> </div> </div> <div class="col-md-6"> <div class="text-img animation" data-animation="fadeInLeft" data-animation-delay="0.5s"> <a href="https://www.it-doneright.co.uk/blog/windows-10-is-going-to-require-7gb-of-storage-for-future-updates"> <div class="image"> <img class="img-responsive" src="https://www.it-doneright.co.uk/images/windows-ten-updates-needing-7gb-space-on-hard-drive.jpg" alt="Windows 10 is going to require 7gb of storage for future updates"> </div> <p>Windows 10 is going to require 7gb of storage for future updates</p> </a> </div> </div> </div> </div> </div> I did look on Google before posting but could not get my head around how to do it, could anyone point me in the right direction or start me off and will have a go
  12. smile

    Time expiration script help?

    Thank you everyone for your replies. "Alright. Your active and expired links/images are the same. What is supposed to be different?" I copied the image code from internet and did not find same size different image but trust me the code works. I would appreciate help with barebones from my PHP code to JS so I can adapt it by populating with my data.
  13. benanamen

    Doctrine, Composer, and namespace

    @NotionCommotion, thanks, that explanation is exactly what I was getting at. It helps put everything in perspective. Glad you figured out the problem.
  14. Last week
  15. NotionCommotion

    Doctrine, Composer, and namespace

    Immediate issue solved. It appears that all extended classes (and not just intermediate extended classes) need to included in the grandparent's explicit distriminatorMap. Also, at least one of the intermediate extended classes needs to have an explicit distriminatorMap. Also, the distriminatorColumn needs to be defined in any extended classes (i.e. AirVehicles and GroundVehicles) which also extend other classes, and needs to use the same name as the grandparent's distriminatorColumn. I didn't come across any documentation to this effect, but it seems to work as desired. #MyNamespace.MyApp.Vehicle.Vehicle.dcm.yml MyNamespace\MyApp\Vehicle\Vehicle: type: entity table: vehicle_table inheritanceType: JOINED discriminatorColumn: name: discriminator_column type: string discriminatorMap: vehicle: Vehicle airvehicle: MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle car: MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car train: MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train groundvehicle: MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle airplane: MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane rocket: MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket repositoryClass: VehicleRepository id: id: type: integer generator: strategy: AUTO fields: grandParentItem1: type: string grandParentItem2: type: string #MyNamespace.MyApp.Vehicle.AirVehicle.AirVehicle.dcm.yml MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle: type: entity table: air_vehicle extends: MyNamespace\MyApp\Vehicle\Vehicle inheritanceType: JOINED discriminatorColumn: name: discriminator_column type: string discriminatorMap: airVehicle: AirVehicle airplane: MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane rocket: MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket repositoryClass: AirVehicleRepository id: id: associationKey: true fields: parentItem1: type: string parentItem2: type: string <?php //use MyNamespace\MyApp; error_reporting(E_ALL); ini_set("log_errors", '1'); ini_set('display_startup_errors', '1'); ini_set('display_errors', '1'); require_once "../bootstrap.php"; function createObj($em, $class) { $cn=explode('\\', $class); $cn=$cn[count($cn)-1]; $entity = new $class(); $entity->setChildItem1("$cn c1"); $entity->setChildItem2("$cn c2"); $entity->setParentItem1("$cn p1"); $entity->setParentItem2("$cn p2"); $entity->setGrandParentItem1("$cn g1"); $entity->setGrandParentItem2("$cn g2"); try{ $em->persist($entity); $em->flush(); echo "Created $class with ID " . $entity->getId() . "\n\n"; } catch(\Exception $e) { echo($class.' - '.$e->getMessage()."\n\n"); } } function displayMember($em, $class, $id) { echo("Display Member $id for $class\n\n"); try{ $member=$em->find($class, $id); print_r($member); } catch(\Exception $e) { echo($class.' - '.$e->getMessage()."\n\n"); } } function displayAllMembers($em, $class) { echo("Diaplay All Members for $class\n\n"); $repository = $em->getRepository($class); try{ $members=$repository->findAll(); print_r($members); } catch(\Exception $e) { echo($class.' - '.$e->getMessage()."\n\n"); } } $entities=[ 'Vehicle'=>['class'=>'\MyNamespace\MyApp\Vehicle\Vehicle','children'=>[ 'AirVehicle'=>['class'=>'\MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle','children'=>[ 'Rocket'=>'\MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket', 'Airplane'=>'\MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane' ]], 'GroundVehicle'=>['class'=>'\MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle','children'=>[ 'Train'=>'\MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train', 'Car'=>'\MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car' ]], ] ], ]; //Creating works correctly foreach($entities as $grandparentName=>$grandparent) { //createObj($em, $grandparent['class']); //Abstract foreach($grandparent['children'] as $parentName=>$parent) { //createObj($em, $parent['class']); //Abstract foreach($parent['children'] as $childName=>$class) { createObj($em, $class); } } } displayMember($em, '\MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket', 1); displayMember($em, '\MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle', 1); displayMember($em, '\MyNamespace\MyApp\Vehicle\Vehicle', 1); foreach($entities as $grandparentName=>$grandparent) { displayAllMembers($em, $grandparent['class']); foreach($grandparent['children'] as $parentName=>$parent) { displayAllMembers($em, $parent['class']); foreach($parent['children'] as $class) { displayAllMembers($em, $class); } } } Created \MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket with ID 5 Created \MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane with ID 6 Created \MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train with ID 7 Created \MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car with ID 8 Display Member 1 for \MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 1 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) Display Member 1 for \MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 1 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) Display Member 1 for \MyNamespace\MyApp\Vehicle\Vehicle MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 1 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) Diaplay All Members for \MyNamespace\MyApp\Vehicle\Vehicle Array ( [0] => MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 1 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) [1] => MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 2 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g2 ) [2] => MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 3 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g2 ) [3] => MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 4 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g2 ) [4] => MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 5 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) [5] => MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 6 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g2 ) [6] => MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 7 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g2 ) [7] => MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 8 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g2 ) ) Diaplay All Members for \MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle Array ( [0] => MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 3 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g2 ) [1] => MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 4 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g2 ) [2] => MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 7 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g2 ) [3] => MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 8 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g2 ) ) Diaplay All Members for \MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Array ( [0] => MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 1 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) [1] => MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 5 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) ) Diaplay All Members for \MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane Array ( [0] => MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 2 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g2 ) [1] => MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 6 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g2 ) ) Diaplay All Members for \MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle Array ( [0] => MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 1 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) [1] => MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 2 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g2 ) [2] => MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Rocket\Rocket:private] => Rocket c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Rocket p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 5 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Rocket g2 ) [3] => MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane Object ( [childItem1:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c1 [childItem2:MyNamespace\MyApp\Vehicle\AirVehicle\Airplane\Airplane:private] => Airplane c2 [parentItem1:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p1 [parentItem2:MyNamespace\MyApp\Vehicle\AirVehicle\AirVehicle:private] => Airplane p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 6 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Airplane g2 ) ) Diaplay All Members for \MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train Array ( [0] => MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 3 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g2 ) [1] => MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Train\Train:private] => Train c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Train p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 7 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Train g2 ) ) Diaplay All Members for \MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car Array ( [0] => MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 4 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g2 ) [1] => MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car Object ( [childItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c1 [childItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\Car\Car:private] => Car c2 [parentItem1:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p1 [parentItem2:MyNamespace\MyApp\Vehicle\GroundVehicle\GroundVehicle:private] => Car p2 [id:MyNamespace\MyApp\Vehicle\Vehicle:private] => 8 [grandParentItem1:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g1 [grandParentItem2:MyNamespace\MyApp\Vehicle\Vehicle:private] => Car g2 ) )
  16. Barand

    PHP in CSS with SQL and Sessions

    here's the code that produced the example <?php $res = $db->prepare("SELECT s.subject , r.pcent FROM pupil p JOIN result r USING (pupilid) JOIN subject s USING (subjectid) WHERE p.lname = ? AND r.schoolyear = 2014 ORDER BY subject; "); $res->execute( [ 'Wilson'] ); $tdata = ''; foreach ($res as $r) { $tdata .= "<tr><td>{$r['subject']}</td> <td>{$r['pcent']}</td> <td>" . bar (400, 30, $r['pcent']) . "</td> </tr>"; } /** * bar chart * * @param int $wid * @param int $ht * @param mixed $val * @param int $max optional default 100 */ function bar($wid, $ht, $val, $max=100) { $bar = "<svg width='$wid' height='$ht' viewBox='0 0 $wid $ht'>\n"; $pix = $wid/$max; if ($val > 100) $val = 100; // percentage labels for ($p=25; $p<=75; $p+=25) { $ty=10; $tx = $p * $pix; $bar .= "<path d='M $tx $ty l 0 2' stroke='#AAA' /> <text x='$tx' y='$ty' class='pcent' >{$p}%</text>\n"; } // draw bar $w = $val * $pix; $h = $ht-12; $bar .= "<rect x='0' y='12' width='$wid' height='$h' stroke='#444' fill='#EEE' />\n"; $bar .= "<rect x='0' y='12' width='$w' height='$h' fill='#F48A11' />\n"; $bar .= "</svg>\n"; return $bar; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="generator" content="PhpED 18.0 (Build 18044, 64bit)"> <title>Sample</title> <meta name="creation-date" content="02/15/2019"> <style type="text/css"> table { width: 500px; margin: 10px auto; } .pcent { font-family: calibri, sans-serif; font-size: 8pt; fill: #AAA; } </style> </head> <body> <table> <tr><th>Subject</th><th>Pcent</th><th>Chart</th></tr> <?=$tdata?> </table> </body> </html>
  17. Cobra23

    PHP in CSS with SQL and Sessions

    Very very similar Barand. One query is always best. How does one do the SVG part? I've never used SVG. I do have a few different colors and meanings for all the different graphs produced in the same table and their percentages. Anyways, I did get this to work perfectly for what i'm doing and stopped users getting kicked out. I'm still curious to know about the other option in SVG output instead of dynamically adding php variables automatically to the css and produce the classes.
  18. Barand

    PHP in CSS with SQL and Sessions

    From the calculations in your code I am guessing you are trying to produce something like below using a weird method involving dynamic CSS (different data, I know, but similar scenario) . Am I right? As ginerjm pointed out, a single query should be used, not queries inside a loop. The output below used this data pupil result subject +---------+--------+------------+ +---------+-----------+-------+------------+----------+ +-----------+-----------+ | pupilID | fname | lname | | pupilid | subjectid | pcent | schoolyear | resultid | | subjectID | subject | +---------+--------+------------+ +---------+-----------+-------+------------+----------+ +-----------+-----------+ | 8 | Emma | Watson | | 8 | 1 | 91 | 2014 | 4 | | 1 | English | | 9 | George | Wilson | | 9 | 1 | 62 |* 2014 | 5 | | 2 | German | | 15 | Jack | Williams | | 14 | 1 | 64 | 2014 | 8 | | 3 | Geography | | 19 | Mary | Whitehouse | | 15 | 1 | 93 | 2014 | 9 | | 4 | Maths | +---------+--------+------------+ | 19 | 1 | 60 | 2014 | 11 | | 5 | Economics | | 9 | 5 | 50 |* 2014 | 41 | | 6 | Biology | | 14 | 5 | 51 | 2014 | 43 | | 7 | Chemistry | | 9 | 7 | 89 |* 2014 | 57 | | 8 | Physics | | 14 | 7 | 53 | 2014 | 59 | | 9 | History | | 9 | 9 | 87 |* 2014 | 76 | | 10 | Computing | | 15 | 9 | 54 | 2014 | 78 | +-----------+-----------+ | 19 | 9 | 58 | 2014 | 81 | | 8 | 1 | 73 | 2015 | 85 | | 9 | 1 | 93 | 2015 | 86 | | 14 | 1 | 79 | 2015 | 89 | | 15 | 1 | 94 | 2015 | 90 | | 19 | 1 | 71 | 2015 | 92 | | 9 | 5 | 95 | 2015 | 122 | | 14 | 5 | 92 | 2015 | 124 | | 9 | 7 | 69 | 2015 | 138 | | 14 | 7 | 76 | 2015 | 140 | | 9 | 9 | 61 | 2015 | 157 | | 15 | 9 | 86 | 2015 | 159 | | 19 | 9 | 79 | 2015 | 162 | +---------+-----------+-------+------------+----------+ with this single query to get the 2014 exam results for Wilson SELECT s.subject , r.pcent as pcent FROM pupil p JOIN result r USING (pupilid) JOIN subject s USING (subjectid) WHERE p.lname = 'Wilson' AND r.schoolyear = 2014 ORDER BY subject; The charts were drawn using just the pcent values from the database without specific classes for the pcent values, just generated SVG graphics.
  19. NotionCommotion

    Doctrine, Composer, and namespace

    @benanamen, I am building a web interface to manage various industrial integration gateways. Some act as servers and others act as clients. Some utilize ethernet and others utilize rs-485 serial communication. Typical protocols include modbus, devicenet, bacnet, lonworks, profibus, etc. To implement this, I am creating an object (with injected other objects) for each which fulfills the required functionality. There are some portions where inheritance is well fit and I wish to extend classes. Current implementation uses a mapper class to pull the various properties from the db which are injected into an entity object. Everything is vanilla PHP without some 3rd party framework and it works as desired, but is becoming more and more difficult to manage, and I feel that maybe I should be using some dedicated orm. Maybe I shouldn't be using an orm (and if so, whether it should be doctrine), but the only way I know how to confirm this is to personally try it out and create new entities, retrieve one by its ID, retrieve a set of them, modify them, etc. And while I can do this initially for the entire application, it is much simpler to do so for a mock application of vehicles, rockets, etc. So... assuming this is just an academic exercise to create a Rocket that is inherited from a Vehicle, does my entity meta data look reasonable? Do you know why I am unable to retrieve an entity by ID or retrieve a group of entities? Thanks
  20. benanamen

    Doctrine, Composer, and namespace

    I cant teach you anything correctly if I don't know you are really doing. Sure I get you are asking "how to implement Class Table Inheritance using Doctrine ", but from my position, I have no idea if that is actually the correct solution to your problem. By forcing me to focus on your attempt instead of the problem you are locking yourself out of any other potential or better solutions. If you just plain ol wanted to learn Class Table Inheritance using Doctrine, that is one thing, but it comes across as though you have deemed this to be the solution to a problem at hand. I know your not asking me to build you something. I was trying to get across an easy way for me to understand what I was asking of you. The very nature of all your posts being outside the realm of what many of us with numerous years experience have ever seen makes it even more important to know what the actual project is. Honestly, I have often wondered if PHP is even the right language for whatever it is you are doing. Since I, and others have no clue to what it is, who's to say.
  21. NotionCommotion

    Doctrine, Composer, and namespace

    I appreciate your passion to abolishing all xy problems, however, I am not asking for you to build something for me but for you to teach me something. Specifically, how to implement Class Table Inheritance using Doctrine.
  22. benanamen

    Doctrine, Composer, and namespace

    Seems to be a DB design problem but since I still have no idea what is going on so I cant really say. You keep replying about HOW you are trying to solve a problem. I have no idea what this is really about. Best I can tell it has something to do with cars, trains, rockets and airplanes. What is the overall project at hand? Forget that you know any programming at all and you are telling me about something you want me to build for you.
  23. dil_bert

    armbian and udoo-quad: which one does fit most?

    https://www.armbian.com/udoo-quad/ Armbian Stretch legacy kernel 4.4.y Armbian Bionic legacy kernel 4.4.y
  24. NotionCommotion

    Doctrine, Composer, and namespace

    Below is some sample data. SELECT *, 'airplane' FROM vehicle_table vt INNER JOIN air_vehicle av ON av.id=vt.id INNER JOIN airplane_table ap ON ap.id=av.id WHERE vt.id>=32 AND vt.id<=42 UNION SELECT *, 'rocket' FROM vehicle_table vt INNER JOIN air_vehicle av ON av.id=vt.id INNER JOIN rocket_table rt ON rt.id=av.id WHERE vt.id>=32 AND vt.id<=42 UNION SELECT *, 'car' FROM vehicle_table vt INNER JOIN ground_vehicle gv ON gv.id=vt.id INNER JOIN car_table ct ON ct.id=gv.id WHERE vt.id>=32 AND vt.id<=42 UNION SELECT *, 'train' FROM vehicle_table vt INNER JOIN ground_vehicle gv ON gv.id=vt.id INNER JOIN train_table tt ON tt.id=gv.id WHERE vt.id>=32 AND vt.id<=42; id grandParentItem1 grandParentItem2 discriminator_column id parentItem1 parentItem2 id childItem1 childItem2 type 32 Airplane g1 Airplane g2 airplane 32 Airplane p1 Airplane p2 32 Airplane c1 Airplane c2 airplane 36 Airplane g1 Airplane g2 airplane 36 Airplane p1 Airplane p2 36 Airplane c1 Airplane c2 airplane 40 Airplane g1 Airplane g2 airplane 40 Airplane p1 Airplane p2 40 Airplane c1 Airplane c2 airplane 35 Rocket g1 Rocket g2 rocket 35 Rocket p1 Rocket p2 35 Rocket c1 Rocket c2 rocket 39 Rocket g1 Rocket g2 rocket 39 Rocket p1 Rocket p2 39 Rocket c1 Rocket c2 rocket 34 Car g1 Car g2 car 34 Car p1 Car p2 34 Car c1 Car c2 car 38 Car g1 Car g2 car 38 Car p1 Car p2 38 Car c1 Car c2 car 42 Car g1 Car g2 car 42 Car p1 Car p2 42 Car c1 Car c2 car 33 Train g1 Train g2 train 33 Train p1 Train p2 33 Train c1 Train c2 train 37 Train g1 Train g2 train 37 Train p1 Train p2 37 Train c1 Train c2 train 41 Train g1 Train g2 train 41 Train p1 Train p2 41 Train c1 Train c2 train
  25. requinix

    PHP Include with Open ELSE

    Executed. Not inserted. PHP did not perform some sort of virtual copy-and-paste of the included file's contents into the point where the include call was. What PHP did was execute the file. You said that an include "is the same as though you cut and pasted". I'm picking at how and why that statement is factually incorrect.
  26. benanamen

    PHP Include with Open ELSE

    If you include a footer before a header file, the footer is going to show up in source on top of the header and vice versa which clearly shows that an include is "inserted" where the include is called. Of course, the OP has some conditional thing going on, but the cut and paste I suggested will show how the code is not "syntactically valid " as you already mentioned. As for your example using a conditional, the first one is saying "if true is false, then include the file". Since true is not false, it doesn't include it. In the second example, you are not using curly braces, so only one statement is evaluated in the if, which is of the same effect as the first one, if true is false, then echo the first line". True is not false, so it doesn't echo the first line. Seems we might not be on the same page. Kindly explain what you wanted me to see about the example. FYI: You did get me to learn up on something. Since I always use curly braces I didn't know without them only one statement is evaluated.
  27. NotionCommotion

    Doctrine, Composer, and namespace

    Hello benanamen, I've never used a 3rd party ORM before and have previously used homespun scripts of my own. Have you ever used one, and specifically have you ever used Doctrine? The reason I put my Vehicle/AirVehicle/Rocket example together was primarily so I can get a small simple implementation working before deploying it to a more complicated application. I can successfully create new entities and store them in the database as shown by my previous post, but have not been successful retrieving all entities of a given type nor retrieving a given entity by ID. Do you know what I am doing wrong? Thanks
  1. Load more activity
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up
×

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.