-
Posts
4,669 -
Joined
-
Last visited
-
Days Won
173
kicken last won the day on November 29
kicken had the most liked content!
About kicken

Contact Methods
-
Website URL
http://aoeex.com/
Profile Information
-
Gender
Male
-
Location
Bonita, FL
-
Age
36
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
kicken's Achievements
-
I'm assuming you mean a mobile app. I'd ask if you actually need an app vs just a mobile friendly website. Making the website mobile friendly would probably be easier. You could give it a manifest file and users could even add it to their home screen as if it were an app.
-
Because you are only counting extras if they were not expected at all ($expected_counts[$sku] is not set). Your extra 3333 item was an expected sku, you just got too many. Your code can be much simpler by just calculating the counts of expected vs received for each sku rather than doing your array_fill stuff and checking index existence. $all_skus = array_merge(array_keys($expected_counts), array_keys($received_counts)); $reconciled = []; foreach ($all_skus as $sku){ $reconciled[$sku] = ($expected_counts[$sku] ?? 0) - ($received_counts[$sku] ?? 0); } $reconciled = array_filter($reconciled); First get a combined list of all possible SKUs, then loop over that list and for each SKU calculate # of expected (0 if unexpected) - # of received (0 if none received). Finally, filter out all the entries that ended up as 0 (received and expected match). You're left with an array of SKUs with either positive (missing) or negative (too many) items. If you really need an array of SKU's, you can expand the reconciled array out as necessary.
-
Not just start the file with. Every PHP code block must use <?php (or <?= for the short echos). The Statement.php file you just uploaded contains blocks where you did not fix this issue. Line 101 <? $stmt = GetAllData($Date); echo $stmt; Line 156 <? } else { ?> Line 161 <? } ?> Line 174 <? } ?> You need to fix ALL of these tags. Do so in ALL of your files.
-
How to transfer data from one database to another.
kicken replied to KangaBytes's topic in MySQL Help
You should probably have SSH access to the server then. Use that to access a shell and you should have access to the mysql and mysqldump tools, they are pretty standard. -
How to transfer data from one database to another.
kicken replied to KangaBytes's topic in MySQL Help
I hope that's a typo and you mean 7.4. Either way, you need to upgrade, but if you really are on 4.4 then you need to upgrade like, yesterday. Having a user that can access both databases would allow you to use the INSERT query you tried. If you're on shared hosting, you probably won't have the ability to do that. If you're using your own server, then presumably you'd be able to use the root user to run the query or adjust the privileges. Assuming this is a one time thing, or just once in a while thing, then the best option with separate users would be to access the command line if you can and use mysqldump command to dump the table from the first database, then use the mysql command load the generated sql file into the second database. -
Inserting multiple values for one user in new column
kicken replied to PNewCode's topic in PHP Coding Help
Sounds like you just want an update query. For example update users_table set reqid=75 where username='joe' If that's not what you want, then you may need to try and explain again differently. -
Trouble with Xdebug Breakpoint using Sublime Text
kicken replied to VaderDark's topic in PHP Coding Help
In order to use step debugging, xdebug.mode needs to contain debug. If it still does not work after adding that, try setting xdebug.start_with_request to yes. I have not used either sublime or that browser extension, so not sure if they need anything special. -
Before anything else, you need to add an ORDER BY clause to your query so that you can ensure a consistent order of your results. Without an ORDER BY clause, the database server is allowed to return the rows in whatever order it wants, usually that's just whatever order it finds them in as it scans the indexes/tables. As you add/remove data that order will change. Once you have your results ordered in a specific way, you can count the number of records that come before a specific row by running a query with a where condition of theOrderByColumn <= yourCurrentRowsOrderByColumn. For example. SELECT id,path, subCategoryId FROM `files` WHERE categoryId=5 AND subCategoryId=15 ORDER BY id; SELECT COUNT(*) FROM files WHERE categoryId=5 AND subCategoryId=15 AND id <= 307
-
You are still using a short tag in that file. </div> <? <------- here $stmt = GetAllData($Date); You need to go through all your files and replace those short tags with proper <?php tags.
-
That's not really the intended way to use this stuff. The intention is more like this: main.php <?php spl_autoload_register(); $app = new Application(); $app->run(); application.php <?php class Application { public function run(){ echo 'Running my application!', PHP_EOL; } } Then run main.php $ php main.php Running my application! Calling spl_autoload_register tells PHP to use the default autoloader (spl_autoload) when it needs to autoload a class. When PHP tries to process the new Application code, it sees that the class Application is undefined, so it calls the registered autoload functions to try and define the class. The standard autoloader function takes the class name, makes it lowercase, then tries to locate the file using the registered extensions in the defined include paths / current directory. If you just have a specific file you want to include, then you don't need to deal with the autoloader, just use include or require directly.
-
PHP calls the autoload function when it encounters a class name that it does not know. The job of the autoload function is to define that class, usually by including the file which contains it. It means that if you call spl_autoload_register(); //Note, no parameter is passed. without providing a function, it's treated as if you had called spl_autoload_register('spl_autoload'); The default autoload function does this in a simple way, it basically takes the class name, converts it to lower case, then checks if a file with that name + an extension exists and if so, includes it. You can control which extensions it checks by using spl_autoload_extensions. You control which directories it looks in using the include path. If you need more complex logic or control for loading your class files, then you would provide your own autoload function rather than use the default one.
-
Redirect to installer if database is empty - Codeigniter 3
kicken replied to Moorcam's topic in Frameworks
I'm not familiar with CI3, but assuming it has a single entry point file, it'd probably be best to add an explicit check there rather than in places your DB is used. -
Arrays are accessed using square-brackets, not parenthesis. That change should have been to $param[0] You don't name the function spl_autoload_register, that is a predefined function that accepts a callback. I'm assuming your original code looked like this: if ( ! function_exists('__autoload')) { AutoLoader::addFolder(array(APP_PATH.DIRECTORY_SEPARATOR.'models', APP_PATH.DIRECTORY_SEPARATOR.'controllers')); function __autoload($class_name) { AutoLoader::load($class_name); } } To update it, the easiest thing to do would be to rename the __autoload function to something unique for your application, then call the built-in spl_autoload_register function with that new name. You can also remove the if statement as it's no longer needed. AutoLoader::addFolder(array(APP_PATH.DIRECTORY_SEPARATOR.'models', APP_PATH.DIRECTORY_SEPARATOR.'controllers')); function my_app__autoload($class_name) { AutoLoader::load($class_name); } spl_autoload_register('my_app__autoload');
-
I'm not really sure what you're after, and your code is not very easy to understand. Your screenshots all seem basically identical to me so that doesn't help clear things up either. Is the goal to only show the "settings button" next to specific items? I'd suggest you start with just trying to clean up your code to make it easier to understand and improve the formatting. Your pages array for example should be using all named keys rather than a bunch of numeric ones and a couple named ones. That way it'll be much clearer what all the settings are for each item. A more advanced improvement may be to replace the array's with an object with properties, but just adding named keys would be good enough for now. Something like: $pages = [ [ 'name?'=>'overview', 'label?'=>$lang->line('lm_overview'), '???1'=>'', '???2'=>'FFF', '???3'=>'', '???4'=>'1', '???5'=>'1', 'second_button' => true, 'button_enabled' => true ], ... ]; $second_button_pages = [ [ 'name?'=>'empire', 'label?'=>$lang->line('lm_empire'), '???1'=>'', '???2'=>'FFF', '???3'=>'', '???4'=>'1', '???5'=>'1' ], ... ]; I labeled them all with a ? because I honestly have no idea what those elements are for. Giving them a descriptive key name would solve that and make your code much easier to read and understand. Think about when you come back to this in 9 months and need to add a new menu item, the way it is now you'll have no idea what data to put in the array or where. In your template file, the indentation could be improved. Make sure the content that is within a conditional is indented to be within that conditional, right now it's kind of all over the place. You also seem to have unnecessary conditions, possibly related to the poor indentation. Notice you are checking if $main_button is true when you're in a branch that has already determined that it's true. That check is unnecessary. Your check of $snd could be unnecessary. If $snd is an empty array, the foreach loop will do nothing and thus not output anything, so there is no need to check that it's not empty before hand. Checking if $button is true is also probably unnecessary, as you probably just shouldn't be putting any empty values into your $snd array in the first place. If you take all that out, your template code is much simpler. You should also be moving your style="" stuff into classes and just apply the class to simplify the template even more. <table> @if ($main_button) <tr> <td style="display: flex;flex-direction: row;flex-wrap: nowrap; justify-content: center;"> <div class="holo-container" style="background-image: url('public/upload/skins/xgproyect/menu/holomen.png'); background-size: contain;"> <span> {!! $menu_link !!} </span> </div> <div> @foreach ($snd as $button) <a href="{{ $button[0] }}" style="color: #fff"> <button class="holo-button" style="right: 25px; position: absolute; background-image: url('public/upload/skins/xgproyect/menu/sbutton.png'); background-size: contain; width: 32px; height: 32px; background-color: #fff0; border: none;"> <img src="public/upload/skins/xgproyect/menu/cog.svg" alt="Cog Icon" style="width: 100%; height: 100%; filter: invert(100%);"> </button> </a> @endforeach </div> </td> </tr> @endif </table> You also probably shouldn't be using <table> for this, and you shouldn't be using <font> either for your links. For your list of menu items you'd probably want <nav> containing a <ul> and a <li> per button. For the button text, put a css class on the span tag that controls the color. Take a pass at cleaning things up, then try posting again to explain what you want and better screenshots of what you want to see vs what you are seeing if you still have issues.
-
No, it does not. PHP doesn't do CORS. You can make whatever request you want to whatever destination you want with PHP. CORS is something implemented by browsers to restrict JavaScript's ability to create requests, it has no affect on server-side requests like those made from PHP, Python, NodeJS, etc.