Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. A better data type for prices is decimal EG current_price DECIMAL(10,2) , Also your dates should be stored as DATE type (yyyy-mm-dd), not int. Then you get maximum utitlity from all the datetime functions. What query have you tried so far? Do you have data for every day going back 1 year or more?
  3. Today
  4. hi, i have a database 'sampledb" and one table 'sampletable' in it. this table contain only three fields named 'symbol' , 'price' , 'date' . the data type of symbol is varchar, float, and int respectively. I inserted date values as 20220928 format. I want to display data values horizontally on my web page such as: symbol current price last week price last month price last year price ABC 12.52 11.0 13.69 12.2 PQR 6.5 5.72 5.0 10.13 XYZ 150 119 200 182 What php code / sql query should i need to write? thanks
  5. also for the issue itself the problem was that opacity that was set for every element with a black background insteadof using the rgb() colors which you set opacity directly inside the rgb() . it doesnt fix the problem i has but for the child elements disapeariing it fixed it. and finally for the darker effect it was the arrays having all black background paired with opacity one over the others was making the page go darker and darker because it seems like for each row a new array populated with the previous and new row is generated so it makes a lot of arrays piling one over the others.
  6. sorry for the delay, its a bit complicated to explain because it is the way the table is made and i did something else instead i will try to find a way to make paginations for the ranking instead of trying to make a scrollable ranking that would always stay the same size
  7. sorry i didnt see that there was a reply. but i just fixed it by doing this $WINNERSID[] = intval($WINNERS_ROW['participationid']); $winners1[] = array_slice($WINNERSID, 0, $num_winners3); if ($winners = array_filter($winners1)) { foreach ($winners as $value) { if (in_array($_SESSION['id'], $value) && $prizepaid == false) {
  8. dont worry i finally got it working after a week stuck on this $WINNERSID[] = intval($WINNERS_ROW['participationid']); $winners1[] = array_slice($WINNERSID, 0, $num_winners3); if ($winners = array_filter($winners1)) { foreach ($winners as $value) { if (in_array($_SESSION['id'], $value) && $prizepaid == false) { i simply removed the intval() from the $_SESSION id and stored the ids as int into the winnersid array. i so much tried every single thing i could on this one this has to be the simplest thing i had to change .. this is hilarious .
  9. Just a quick thought - doesn't the function in_array kinda do this for you? Your code is only looking for a single array element, no? So it's s/b quick
  10. no matter what i tried , nothing is working and i have tried every single array functions. i need to compare $value1 with the $_SESSION['id'] $winners1[] = array_slice($WINNERSID, 0, $num_winners3); if ($winners2 = array_filter($winners1)) { foreach ($winners2 as $value1) { if (in_array(intval($_SESSION['id']), $value1) && $prizepaid == false) { value1 contains this: array(2) { [0]=> string(2) "24" [1]=> string(2) "25" } normally i believe it shouldnt be so complicated to see if the user id is the same as one of those numbers from the array..
  11. Yesterday
  12. You made it more complicated than it needs to be: /[A-Z]/
  13. I am trying to make the password contain one uppercase letter when registering but I am not sure how to do that in PHP. Am I writing the right regex for it? //password must contain a capital letter if (preg_match('/((?=.*[A-Z]))/', $pw)) { array_push($this->errorArray, Constants::$passwordContainCapital); return; }
  14. Last week
  15. Yeah, the Permission vs PermissionEnum thing kind of confusing to me as well! Yes, Doctrine has generic support for them. Will downgrade and wait it out. Thanks PS. I had tried to throw an __isString() in my enum, but evidently doing so is a no-no. Guess an __isInt() is a bit too niche and I understand why it doesn't exist.
  16. It's unclear to me whether you'd modify that or add a new type since your Permission vs PermissionEnum is confusing to me. I've not used Enums personally yet, so I was unsure if Doctrine had generic support for them or not. From that bug report, it looks like it does and you might just need to downgrade for a bit and wait for the fix to get released.
  17. Thanks kicken, I had attempted to change App\Doctrine\Types\PermissionType (this is what you meant by doctrine configuration, right?) to not use a generic small int type and instead use a normal int type but it remained small int. Thinking it is a doctrine bug https://github.com/doctrine/orm/issues/10066.
  18. As far as I am aware, no. If you want the numeric value, you access the ->value property. I believe what you'll have to do is change your doctrine configuration to not use a generic small int type and instead use specific PermissionEnum type.
  19. Single sign-on means one place that you use to log in. It does not necessarily mean that you use it to sign in once and then nothing has to ask for your account again. In fact it shouldn't: the place with your account should be asking you each time whether you want to allow $app access to your account. If you coded the account stuff yourself and you're being asked multiple times then it means your app is not remembering you. If you wanted, you could have it remember you (like with a cookie) so that next time all you'd need to do is click a button to allow access. One way or another, you really should make sure that you have to click a button or do something - don't make the authentication completely automatic when a different app wants you to sign in. For example, in addition to remembering you, your site can also remember which apps you've allowed access to: if the same app wants access then that could be automatic, but if a different app wants access then your site should tell you first.
  20. The following Doctrine method throws error Warning: Object of class App\\Entity\AccessControl\Acl\PermissionEnum could not be converted to int namespace Doctrine\DBAL\Types; class SmallIntType extends Type implements PhpIntegerMappingType { ... public function convertToPHPValue($value, AbstractPlatform $platform) { return $value === null ? null : (int) $value; } ... } PermissionEnum is a backed integer enum. enum PermissionEnum: int { case public = 0b00; case owner = 0b01; case restrict = 0b10; case extra = 0b11; } Similar to the __toString() magic method, is there a way to change my PermissionEnum so when type casted as an integer, returns an integer? Supplementary info below if of interest While outside of the scope of this question, the following added lines of code were added by Doctrine's latest commit and if removed, the issue goes away. PermissionEnum is used by class Permission which in turn is converted to an integer when saving the the database. namespace Doctrine\ORM\Query; class SqlWalker implements TreeWalker { public function walkSelectExpression($selectExpression) { ... if (! empty($mapping['enumType'])) { $this->rsm->addEnumResult($columnAlias, $mapping['enumType']); } ... } } namespace App\Doctrine\Types; use App\Entity\AccessControl\Acl\Permission; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\ConversionException; use Doctrine\DBAL\Types\Type; final class PermissionType extends Type { private const PERMISSION = 'permission'; public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { return $platform->getSmallIntTypeDeclarationSQL($fieldDeclaration); } public function convertToPHPValue($value, AbstractPlatform $platform): mixed { if (null === $value) { return null; } if (\is_int($value)) { return Permission::createFromValue($value); } throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['int', 'null']); } public function convertToDatabaseValue($value, AbstractPlatform $platform): mixed { if (null === $value) { return null; } if ($value instanceof Permission) { return $value->getValue(); } throw ConversionException::conversionFailedInvalidType($value, $this->getName(), [Permission::class, 'null']); } public function requiresSQLCommentHint(AbstractPlatform $platform): bool { return true; } public function getName(): string { return self::PERMISSION; } } class Permission { private const READ = 0b0000000011; private const CREATE = 0b0000001100; private const MODIFY = 0b0000110000; private const DELETE = 0b0011000000; private const COWORKER = 0b0100000000; // Not currently used. private const OWNER = 0b1000000000; // Not currently used. public function __construct( private ?PermissionEnum $read=null, private ?PermissionEnum $create=null, private ?PermissionEnum $modify=null, private ?PermissionEnum $delete=null, private ?bool $restrictToOwner=null, private ?bool $coworkers=null ) { } public function getValue(): ?int { if($this->hasNullValue()) { throw new Exception('Permission has NULL values.'); } $rs = $this->read->value | $this->create->value << 2 | $this->modify->value << 4 | $this->delete->value << 6; $rs = $this->coworkers ? $rs | self::COWORKER : $rs & ~self::COWORKER; return $this->restrictToOwner ? $rs | self::OWNER : $rs & ~self::OWNER; } }
  21. So I have registered my in-house developed app on Azure and configured SAML SSO. I have also implemented the required code on my PHP app to authenticated to Azure using SAML. Why when I have already authenticated for MS Teams does Azure again ask my password the first time I try to access my web application? Is the SSO token on my browser used for web apps different from the SSO token for Microsoft apps eg Teams . I am very new to Azure. My app is written in PHP.
  22. Might need a wordpress forum for this question. Or someone here who uses it a lot
  23. Good morning everyone! I'm a student, and I'm struggling with an assignment. Part of the trouble is that all of the PHP code is provided for me and I am mostly guessing with my understanding. I was tasked with modifying it to match my table. I am also very inexperienced with WordPress, which doesn't help. I'm not looking for you to complete my assignment, just to give me a nudge so that I can do so. I have attached several screenshots. My Table the Code Snippet used to create the page, and the function added to the functions.php file. The View Students page accurately displays data from the database. The Add Student form allows you to complete the form, but it won't populate the database. I can do this manually through SQL, but the assignment calls for doing so using the form. Thanks everyone! --Exco
  24. Excoastie

    Newbie

    Good morning everyone! Newbie living in the northwest corner of Louisiana. I'm not a developer, I am a student (at 50 y/o). Just wanted to say HI --Exco
  25. function is_leapyear($year){ if(is_numeric($year)){ if($year%4 == 0) { // if it's divisible by 4 its probably a leapyar if($year%100 == 0) { // but check the century condition return ($year%400 == 0); // if its divisible by 400 return true otherwise return false } else return true; } } return false; // if we get to here, return false }
  1. Load more activity
×
×
  • 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.