-
Posts
24,604 -
Joined
-
Last visited
-
Days Won
830
Everything posted by Barand
-
The bankroll would become 450 only if you lost.
-
If you win the first bet, you should then have 600. If you win, they pay you.
-
return $bankroll = $bet * $odds - $bet + $bankroll; ^^^^^^ Are you sure you should be losing your stake when you win?
-
One more question - is there a minimum bet? If it's 10% of the current bankroll and you keep losing, you could, at some point, be betting 0.0000000001 euros
-
Clarification required. Your bet is 10%. Does that mean that, if you start with 500.00, you will always bet 50.00, or will your next bet be 10% of your current bankroll? You say 500 times, but what if you are unlucky and run out of cash?
-
PHP v8 doesn't let you mix indeterminate types, such as adding an empty string to an int. $a = 1; $b = '2'; $c = ''; echo $a + $b; // 3 OK echo $a + $c; // Unsupported operand types: int + string echo $a + (int)$c; // 1 OK Use a cast to int. $this->hou += (int)$split[0]; That said, you really are doing the calculations the hard way $t1 = '09:30:00'; $t2 = '17:15:00'; $dt1 = new DateTime($t1); $dt2 = new DateTime($t2); echo $dt2->diff($dt1)->format('%H:%I:%S'); // 07:45:00
-
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
The correct fix would be to use prepared queries. CSV files are expected to have "..." around some string values and fgetcsv() should allow for them. Perhaps there is something weird regarding their placement in your data. -
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
If you want to use silly names like that with the "." at the end then you need the column name inside backticks. SELECT `KNr.` FROM .... From MySQL manual -
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
Sorry. Not used to mysqli (I always use PDO). It should be fetch_row(); -
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
I'd create and array of KNr's from the CSV and a second array of KNr's from your table then compare the arrays for differencess (array_diff() ) EDIT: Something like this $array1 = []; $array2 = []; $file = fopen($filename, "r"); while (($column = fgetcsv($file, 10000, ";")) !== FALSE) { $array1[] = $column[0]; } $res = $con->query("SELECT KN2 from adressen_neu"); while ($row = $res->fetch_num() ) { $array2[] = $row[0]; } echo '<pre>' . print_r(array_diff($array1, $array2), 1) . '</pre>'; -
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
I've just spotted the "key" icon next to KNr ( I was expecting a separated to column to say which columns were keys) so it looks like that is the primary key. That makes your checking for missing records simple. You just need to see which KNr values are not in the db table but are in the csv file. -
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
Those ... tell us sweet FA (Why is phpmyadmin so useless?). What about my other question about unique identifiers> -
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
I was hoping to see which column was the primary key and if you had any other keys defined on any columns. That was why I requested the the output from SHOW CREATE TABLE. I can't see anything defined there, so is there anything in those records that uniquly identifies a record? -
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
What is your table's structure? SHOW CREATE TABLE adressen_neu; -
PHP CSV Upload - Some rows in CSV file aren't in database
Barand replied to KN1V3S's topic in PHP Coding Help
You are inserting using the slowest method possible. Are the missing rows always from the end of the CSV file, or is it skipping rows from the middle? -
Perhaps... <link rel='stylesheet' href='https://www.w3schools.com/w3css/4/w3.css'> <form id="form1"> <div class='w3-container w3-display-topright w3-light-gray w3-third' > <div class='w3-cell-row w3-padding-small'> <div class='w3-container w3-cell' style='width:120px'>Email</div> <div class='w3-container w3-cell'> <input class='w3-input w3-card w3-tiny' type='text' name='email'> </div> </div> <div class='w3-cell-row w3-padding-small'> <div class='w3-container w3-cell' style='width:120px'>Password</div> <div class='w3-container w3-cell'> <input class='w3-input w3-card w3-tiny' type='text' name='password'> </div> </div> <div class='w3-cell-row w3-padding-small'> <div class='w3-container w3-cell w3-right' style='width: 60%'> <button class='w3-btn w3-small w3-light-grey w3-border w3-right'>LogIn</button> </div> </div> </div> </form> Laptop... Mobile...
-
This is how your output looks in my browser window (Firefox). No idea what it's supposed to look like if that's wrong.. Your inline styles on input fields are a bit off Both have two width settings (5% and 150px) and both the 150px settings have syntax errors the first has a semi-colon instead of a colon the second has "="
-
+-----------------+ +-----------------+ | checkout page | | Server | |-----------------| AJAX request |-----------------| | Send | -----------------------------> | Update DB | | | with product data | | | | | | | | | | | | | | Process | <---------------------------- | return response | | response | | | | | | | | | | | | | | | +-----------------+ +-----------------+
-
A javascript/AJAX process is a common alternative
-
If you need conditional branches of that nature in your method code then I think it's time to consider a separate class or subclass.
-
wordpress Show only if user-role is subscriber AND site visitor
Barand replied to heathcliff's topic in PHP Coding Help
I haven't a clue. It's just test data. Could just as well be [ 'X', 'Y', 'Z' ] -
wordpress Show only if user-role is subscriber AND site visitor
Barand replied to heathcliff's topic in PHP Coding Help
This may be closer $allowed_roles = ['subscriber', 'visitor']; $user_roles = [ 'A' => ['subscriber', 'editor'], 'B' => ['subscriber', 'other', 'visitor'], 'C' => ['manager', 'visitor'], 'D' => ['manager', 'editor' ] ]; foreach ($user_roles as $uid => $roles) { if ( count( array_intersect($roles, $allowed_roles)) == count($allowed_roles) ) { echo "$uid ✓<br>"; } else { echo "$uid ×<br>"; } } -
Follow the "Powered by Invision Community" link at the bottom of this page
-
It may be worth just checking a couple of basic settings. Run this script <?php phpinfo(); ?> Scroll down the output to the PDO section check that there is one check that "mysql" is one of the installed drivers If not, enable them in your php.ini file
-
PS If you want the ID to be the key in the categories array, use $categories = array_column($array, $column, 'id'); // get the category values with id as the key