Jump to content

Barand

Moderators
  • Posts

    24,605
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. http://lmgtfy.com/?q=themeforest
  2. So far you have posted code that makes no sense at all, and a description of the problem that makes even less sense. Do you want to start again?
  3. Store the name of the default image instead.
  4. I don't see your problem - your code only has one while() loop. As in my pseudocode (which shows how your program should work), initialize the total to 0 before the loop. Inside the loop you accumulate the total. After the loop output a row containing the total As for your search problem, you only include a condition in the WHERE clause if a value is provided for that condition.
  5. Show us what you have now. The pseudocode I posted (repeated below) showed you exactly where it goes. total=0; while fetch next row total += row value output the table row end while output total Or did you post the whole code so I could do the amendments for you?
  6. I've given you two methods of getting the total. How many more do you want?
  7. http://lmgtfy.com/?q=android%2Bphp%2Beditor
  8. Not if it is a multidimensional array, and it probably would be. $rows = [ ['name'=>'aaa', 'value'=>55.00], ['name'=>'bbb', 'value'=>25.00], ['name'=>'ccc', 'value'=>100.00], ['name'=>'ddd', 'value'=>255.00], ['name'=>'eee', 'value'=>65.00] ]; echo array_sum(array_column($rows, 'value')); //--> 500
  9. Do you put the rows from the database into an array before outputting to the html table? If so, you could get the total from that array. If not, and you output each table row as you process the query results then you can accumulate the total as output each row. total=0; while fetch next row total += row value output the table row end while output total
  10. Did you forget the date_default_timezone_set("Europe/London"); ?
  11. {..} always need to be in pairs. So both these are correct if (is_paged()) echo "Página 1"; if (is_paged()) { echo "Página 1"; }
  12. date_default_timezone_set("Europe/London"); $now = new DateTime(); echo 'Time now: ' . $now->format('Y-m-d H:i:s') . '<br>'; //--> 2016-09-15 11:50:01 $now->setTimezone(new DateTimeZone('UTC')); echo 'Time UTC: ' . $now->format('Y-m-d H:i:s') . '<br>'; //--> 2016-09-15 10:50:01
  13. Possibly a permissions problem? I think that, when running from IIS, the user is "IUSR_computername".
  14. You have a a single quote after OUTFILE which does not appear to have a corresponding closing quote
  15. Your exec() parameters use $Email and $CompanyName but you put the values into $user and $company
  16. There is no prepare statement in your code. Sorry, but if you you can't understand that what I said in my last post could pose a problem, then you are beyond any help I could offer.
  17. In an earlier post on this forum (http://forums.phpfreaks.com/topic/302132-page-php-how-include-input-and-type-to-search-in-my-table/?do=findComment&comment=15372780) you had So why are you using the `coffee` table with a form for entering firstname, lastname and age? Or are all your tables named `coffee`?
  18. As you process the results, accumulate the total. Check for a change of id and output the total on change.
  19. You would use "Europe/London" The best place to set the default timezone is in your php.ini file. That will save you from having to change every program.
  20. Do the calculation in the query SELECT receptie.id , receptie.marca_tel , receptie.model , receptie.data_primire , articole_service.pret_sol , articole_service.pret_achizitie , articole_service.pret_sol - articole_service.pret_achizitie as profit -- add this FROM receptie inner join articole_service on receptie.id = articole_service.id_receptie then output $row['profit']
  21. You need to familiarize your self with concepts of string variable code You cannot just put code in the middle of a string variable like that, it will just become part of the string. "View source" of your output page to see.
  22. It's the manual that you should be checking http://uk1.php.net/manual/en/mysqli.select-db.php
  23. The slowest part of your function is the database connection. Do not connect every time you call the function - coonect once only at the top of your script then pass the connection variable as a parameter to your functions. You also fetch each row as an array of columns, move them from the array to individual variables then create an object from those variables which you then add to an array. Sounds like a lot of work. Why not pass the row to create your coffee object? while ($row = mysqli_fetch_array($conn, $result)) { // if you use mysqli $coffeeArray[] = new CoffeeEntity($row); }
  24. Set $select='' before the while loop. You are attempting to append to a non-existant string.
  25. @maxxd, That is not a problem. Consider this mysql> SELECT firstname -> , lastname -> , gender -> FROM employees -> ORDER BY lastname; +-----------+----------+--------+ | firstname | lastname | gender | +-----------+----------+--------+ | Emily | Bronte | F | | Jane | Doe | F | | Jack | Evans | M | | Patricia | Jones | F | | Davy | Jones | M | | John | Smith | M | +-----------+----------+--------+ Suppose that, for some weird reason, we wanted all those whose first name began with 'J' to be listed first. mysql> SELECT firstname -> , lastname -> , gender -> FROM employees -> ORDER BY SUBSTRING(firstname,1,1)='J' DESC, lastname; +-----------+----------+--------+ | firstname | lastname | gender | +-----------+----------+--------+ | Jane | Doe | F | | Jack | Evans | M | | John | Smith | M | | Emily | Bronte | F | | Patricia | Jones | F | | Davy | Jones | M | +-----------+----------+--------+ The comparison in the ORDER BY clause evaluates to true(1) or false(0)
×
×
  • 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.