Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. I got better results when I added width and height attributes to your svg echo '<button class="md:hidden rounded-lg focus:outline-none focus:shadow-outline" @click="open = !open"> <svg fill="currentColor" width="50" height="50" viewBox="0 0 20 20" class="w-6 h-6"> <path x-show="!open" fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM9 15a1 1 0 011-1h6a1 1 0 110 2h-6a1 1 0 01-1-1z" clip-rule="evenodd"></path> <path x-show="open" fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path> </svg> </button> ';
  2. Have you tried @mac_gyver's example
  3. It's just another chunk of HTML. <?php echo "<h1>Sample SVG<?h1> <div style='margin-top: 50px;'>"; readfile("svg/sample1.svg"); echo "</div>"; ?> sample1.svg <svg width='200' height='200' viewBox='0 0 200 200'> <defs> <style type='text/css'> .light { stop-color: #F7F7F7; } .mid { stop-color: #777777; } .dark { stop-color: #070707; } .grad { fill: url(#grad1) } .grad2 { fill: url(#grad2) } </style> <linearGradient id='grad1' x1='0' y1='0' x2='1' y2='1'> <stop offset='10%' class='light' /> <stop offset='90%' class='dark' /> </linearGradient> <linearGradient id='grad2' x1='1' y1='1' x2='0' y2='0' > <stop offset='10%' class='light' /> <stop offset='90%' class='dark' /> </linearGradient> </defs> <rect x='0' y='0' width='200' height='200' fill='black' /> <circle cx='100' cy='100' r='80' class='grad' /> <circle cx='100' cy='135' r='40' class='grad2' /> <circle cx='100' cy='135' r='30' fill='black' /> <circle cx='100' cy='46' r='20' class='grad2' /> <circle cx='100' cy='46' r='13' fill='black' /> </svg>
  4. Then change the code. As long as you are telling it to show all buttons, that, strangely, is what it's going to do.
  5. Don't resurrect 10 year old posts. Create your own topic and state your problem with code you've tried (use <> button) The code in this topic uses mysql_ functions which no longer exist in PHP. (Use mysqli or PDO functions) Turn your error reporting and display option ON.
  6. There is no "Group #" in your data - does that come from a member table along with the name? Are those the combinations of date/serid that occur in the data? (So if there 7 services D1/D2/D3/PM/WS/PBB/LS there could potentially be up to 49 columns for each week, or can a serid occur a maximium of once per week?). Dynamic headings created from your supplied test data would be What is the purpose of calid column? The date gives you the week number. (Same goes for your month and year columns)
  7. If it isn't a process that is being called from multiple scripts then I don't see the point of putting it in a stored procedure. Just run your delete query after the update.
  8. They are updated - it's just that the qty value hasn't changed in all of them if the sales were fulfilled by earlier stock records.
  9. Now it looks like you read my post. Have you tried it?
  10. Forget the above. I just noticed you have updated the subquery as I told you! That could be the problem.
  11. Working OK my end (unless I missed something), perhaps it's your data. Send dumps of stock, sales and basket that you are testing with.
  12. You can't join to the stock table in the subquery for the total sales. If you have, say, 3 records for an item then you will treble the sales total for that item. Something like this.. SELECT item_id , sum(quantity) as sold FROM sales sl JOIN basket b ON b.basket_id = sl.basket_id AND b.sale_time > (SELECT MAX(updated_date) FROM stock) GROUP BY item_id
  13. I do it by just showing buttons for first and last and a few either side of the current page +------+ +------+ +------+ +------+ +------+ +------+ +------+ +------+ +------+ +------+ | Prev | | 1 | . . | 97 | | 98 | | 99 | 100 | 101 | | 102 | | 103 | . . | 261 | | Next | +------+ +------+ +------+ +------+ +------+ +------+ +------+ +------+ +------+ +------+
  14. Of course you can. Just process those sales where basket.sale_time > latest stock.updated_date. PS this assumes that that the updated_date is only updated when the stock levels are updated and not when a purchase is added.
  15. The error message tells you the query failed. Try adding a space after "LIMIT" $getQuery = "SELECT * FROM games LIMIT $initial_page, $limit";
  16. Taking a look at just item_id #1. Starting stock : 100 First run sales : 2 Stock now : 98 Second run sales : 12 (2 + 10) Stock now : 86 Third run sales : 17 (2 + 10 + 5) Stock now : 69. Each time you run it you are subtracting sales that have already been subtracted. Each run needs to process only sales since the last stock update. I woud have done this in the query but your sales data contains no date info to make it possible.
  17. That is done in the query. My query can only be run once for a set of sales data as each time it reduces the stock and updates the stock table (as you requested). Not the best method as it means storing derived data. I only did it as an intellectual exercise, picking up the gauntlet that you threw down. As your select query only reads data it can be run as often you want. Using your purchase order table as a stock table is not one of your best ideas. Maintain that table and the sales table then query the two, as you have done, to get the current stock position.
  18. I have recreated your attendance table and have run your code. I now know what you don't want. (109 columns labelled "31-May") Perhaps you could tell us what you do want?
  19. try INSERT INTO stock (stock_id, qty) SELECT stock_id , newqty FROM ( SELECT stock_id , @sales := IF(@prev = k.item_id, @sales, sold) as sales , IF(qty <= @sales, 0, qty - @sales) as newqty , @sales := IF(@sales >= qty, @sales - qty, 0) , @prev := k.item_id as item FROM stock k JOIN ( SELECT item_id , sum(quantity) as sold FROM sales GROUP BY item_id ) s ON k.item_id = s.item_id AND qty_type = 'a' JOIN (SELECT @prev:=null, @sales:=0) init ORDER BY k.item_id, stock_id ) calc ON DUPLICATE KEY UPDATE qty = VALUES(qty);
  20. Why have you contrived a stock table with multiple rows per item? What is the significance of qty_type?
  21. Your create table doesn't show whether they are InnoDb or not. They need to be, MyISAM won't work.
  22. Show us the CREATE TABLE code for those two tbles.
  23. select catid , count(*) as total from table group by catid
  24. Bad SQL syntax, not uncommon when using concatenated segments. If I provide variable values then echo your SQL $Surname = 'Smith'; $Maidenname = 'Jones'; $Firstname = 'Mary'; $sql="SELECT * FROM 1984 WHERE Surname LIKE $Surname AND Maidenname LIKE '%".$Maidenname."%' AND Firstname LIKE '%".$Firstname."%'"; echo $sql; giving SELECT * FROM 1984 WHERE Surname LIKE Smith AND Maidenname LIKE '%Jones%' AND Firstname LIKE '%Mary%' ^^^^^ Don't use SELECT *, specify the columns you need. 1984 table name implies you have separate tables for the people for different years (of birth?). Why not put them in one table and add year column to the data. As G said, use prepared statements, then the query becomes SELECT * FROM 1984 WHERE Surname LIKE ? AND Maidenname LIKE ? AND Firstname LIKE ? ; Provide the data values when you execute the query.
  25. See reply to your first topic (There are many product review sites out there, this is not one.)
×
×
  • 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.