Jump to content

deoiub

Members
  • Posts

    12
  • Joined

  • Last visited

deoiub's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. deoiub

    log2

    I'm attempting to create a PHP function that will calculate a loan's interest rate based on knowing $total_loan_amount, $total_number_of_payments, and $payment_amount. I have found a website with the a JS calculator for this, and includes the function I need to use. https://www.easycalculation.com/mortgage/interest-rate.php However, I'm having a difficult time trying to figure out how to translate this to PHP. I'm getting hung up on calculating q, and specifically the 'divide by log2' portion. Anyone have any suggestions on how to write the q = formula in PHP? Cheers
  2. global $var_name; http://php.net/manual/en/language.variables.scope.php
  3. I've reduced your code above to where you are messing up. If you do a print_r($_POST) at the top of definitions.php script you will see your mistake. - D
  4. echo is how you output the contents of a variable. What happened when you tried it?
  5. I'm assuming the following: - that the form your users fill out is on a web page, with a <form action="...">....</form>. - you then have an action page that uses the form data to query a database and show the results in an HTML table? - then at the bottom of that page, you have a link that says 'download to excel' where you construct a long url in the format: url.com/script.php?var1=content1&var2=cotent2... If my assumptions are correct, then put a form at the bottom of the action page with hidden inputs with your variables, and a submit button instead of a link. <form action='excel_dump.php' method='post'> <input type='hidden' name='var1' value='content1'> <input type='hidden' name='var2' value='content2'> <input type='submit' value='download to excel'> </form>
  6. How long is the query turning out to be? disregarding the security concerns that you seem to realise exist, I'd consider switching the form method to "post" and subsequent changes on the action page to see if that works. -D
  7. The form name isn't passed as a $_POST variable. So isset($_POST['search'] is returning false. A simple fix for your code would be to check if $_POST['fname']) is set, or the name of your submit button. - D
  8. I'm assuming you want to add an OR to your WHERE clause. Currently you are only finding where the users.connected field matches, you probably want to add where the users.Username field also matches.
  9. I think you need to reconsider how you are going about this. The way your loop structure is now, it's going to set all seats in a 'row' to whatever color the 'A' seat is. For instance all seats 3 are going to be the same color as 'A3'. Also, I'm not convinced 'array_key_exists' is what you want to be using. I'd recommend attempting to use nested for loops. The inner loop being cells within a row, and the outer loop being the rows themselves.
  10. You want to look into a 2 dimensional array. setting it, with code something like this: $output_array = array() $output_array[$artist_name][] = $event_date; then outputting it something like this: foreach($output_array as $artists=>$events){ echo "<h1>$artists</h1>"; foreach($events as $event){ echo "<h2>$event</h2>"; } }
  11. In additional to AyKay47's comments, you are also reassigning the value of $no inside of for loop. for($y=0;$y<=$no;$y++){ ... $no=$number($rand_no[1]]; ... ... } if your first random number is 1, your for loop 'while' condition is false on the second pass and the code drops out of the for loop. Your loop will randomly execute between 1 and 5 times (as you start with 0), and on each loop randomly display one of the images, potentially the same image each time. - D
×
×
  • 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.