Re: [PHP] Division by 0

2010-03-10 Thread Joseph Thayne
Looks to me like you are closing your form before you put anything in it. Therefore, the loan_amount is not set making the value 0. Follow the math, and you are dividing by 1-1. Change this line: to: and you should be good to go. Joseph Gary wrote: I have a mortgage amortization scrip

Re: [PHP] Error Message - Need help troubleshooting

2010-03-02 Thread Joseph Thayne
I do not know if the question has been answered, but how are you opening the session? Are you using session_start() or are you using session_register()? Rick Dwyer wrote: On Mar 2, 2010, at 8:48 AM, Ashley Sheridan wrote: How is $item_id created? You've not shown that in your PHP script ex

Re: [PHP] $_POST vs $_REQUEST

2010-02-22 Thread Joseph Thayne
Richard wrote: It's a wise choice to go with $_POST, unless your form is a GET form, in which case use $_GET. $_REQUEST has the potential to open your script(s) up to security issues. I am not sure what the security issues are you are referring to as the $_REQUEST superglobal contains both

Re: [PHP] Dumb Question - Casting

2010-02-18 Thread Joseph Thayne
According to the PHP manual using the same expression, "Never cast an unknown fraction to integer, as this can sometimes lead to unexpected results". My guess is that since it is an expression of floating points, that the result is not quite 8 (for whatever reason). Therefore, it is rounded t

RE: [PHP] SQL insert () values (),(),(); how to get auto_increments properly?

2010-02-13 Thread Joseph Thayne
In order to make this as "sql server independent" as possible, the first thing you need to do is not use extended inserts as that is a MySQL capability. If you are insistent on using the extended inserts, then look at the mysql_info() function. That will return the number of rows inserted, etc. o

RE: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
ment works in phpmyadmin but not in php page On Fri, Feb 12, 2010 at 09:44:47AM +1030, James McLean wrote: > On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne wrote: > > As for the backticks, they are required because of MySQL, not because of > > phpMyAdmin.  The issue was not that

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Yeah, I am a lot more descriptive now. I ran into it quite a bit when I was first starting out. James McLean wrote: On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne wrote: As for the backticks, they are required because of MySQL, not because of phpMyAdmin. The issue was not that

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Fri, Feb 12, 2010 at 8:27 AM, Joseph Thayne wrote: Actually, the syntax is just fine. I personally would prefer it the way you mention, but there actually is nothing wrong with the syntax. The ,'$date1'"." is not correct syntax, change it to ,'".$date.&quo

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Actually, the syntax is just fine. I personally would prefer it the way you mention, but there actually is nothing wrong with the syntax. The ,'$date1'"." is not correct syntax, change it to ,'".$date."' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.ph

Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Try putting tick marks (`) around the field and table names. So your SQL query would then look like: INSERT INTO `history` (`v_id`, `hour`, `visits`, `date`) VALUES (45, 0, 59, '2010 01 27'); This is a good practice to get into. The problem is that MySQL allows you to create tables and fie

Re: [PHP] PHP generated HTML has submit button which picks up the wrong url.

2010-02-05 Thread Joseph Thayne
check to see if submit or submit_x is set. Joseph Ashley Sheridan wrote: On Fri, 2010-02-05 at 14:33 -0600, Joseph Thayne wrote: This is actually a javascript issue rather than a PHP issue. What is happening is that the action of the form is what is being submitted. The action never changes. What

Re: [PHP] PHP generated HTML has submit button which picks up the wrong url.

2010-02-05 Thread Joseph Thayne
This is actually a javascript issue rather than a PHP issue. What is happening is that the action of the form is what is being submitted. The action never changes. What you need to do is have the javascript change the action as well as submit the form (which means you will need to move it to

Re: [PHP] MySQL ID -- what happens when you run out of range?

2010-01-25 Thread Joseph Thayne
That is incorrect. What will happen is as follows: 1. The value will be incremented by 1 causing the value to be greater than the maximum integer allowed. 2. MySQL will see this as a problem and "truncate" it to the closest value. 3. MySQL will then try and insert the new row with the updat

Re: [PHP] MySQL ID -- what happens when you run out of range?

2010-01-25 Thread Joseph Thayne
It will continue to use the max number which of course will cause an error. Joseph Parham Doustdar wrote: Hello there, A friend called me today and was wondering what happens if the ID colomn of an MYSQL database, set to autoinc reaches the int limit. Will it return and begin choosing the ID'

Re: [PHP] Cookies & sessions

2010-01-20 Thread Joseph Thayne
Bruno Fajardo wrote: You don't need to use output buffering at all. You only need this mechanism if your script needs to output stuff before the session_start() or setcookie() functions get executed. Output buffering is also used if you need to "output" something before the headers are sent eith

Re: [PHP] Backup to local drive

2009-12-11 Thread Joseph Thayne
PHP cannot create a folder structure on your local machine. I don't think Javascript or VBScript can either. Your best bet is with the zip files. Windows users have it fairly simple actually (as much as I hate to admit it) as all they would have to do is right-click and "Extract". You can a

Re: [PHP] move_uploaded_file

2009-12-11 Thread Joseph Thayne
When used in PHP, an absolute path does not go off the web root. In Premise 3 below, an absolute path of "/upload" will NOT bring up the directory "/home/prof3ta/projects/moodle/htdocs/upload" but rather simply "/upload" In Windows terms, an absolute path would be "C:\upload" versus "C:\home\

Re: [PHP] Backup to local drive

2009-12-11 Thread Joseph Thayne
If you are wanting to save the information as a PDF (formatted the same as the HTML page), check out tcpdf at www.tcpdf.org. It is fairly simple to implement and can interpret an HTML page causing it to be saved as PDF. Joseph Ben Miller wrote: Hello - I have an application I'm building tha

Re: [PHP] move_uploaded_file

2009-12-11 Thread Joseph Thayne
You should be able to use either an absolute or relative path. In the code below, the path specified is absolute (it starts with /). If you want it to be relative to your current directory, change the line to: $uploads_dir = 'uploads'; or $uploads_dir = '../uploads'; So basically, it all dep

Re: [PHP] Using Curl to replicate a site

2009-12-10 Thread Joseph Thayne
If the site can be a few minutes behind, (say 15-30 minutes), then what I recommend is to create a caching script that will update the necessary files if the md5 checksum has changed at all (or a specified time period has past). Then store those files locally, and run local copies of the files

Re: [PHP] Browsing PHP documentation from Emacs

2009-12-09 Thread Joseph Thayne
Check the following link for help on integrating with Vim: http://vim.wikia.com/wiki/PHP_manual_in_Vim_help_format Kim Emax wrote: Hello Roberto wrote on 2009-12-09 17:08: Hi all, I've just written a small tool for Emacs that will allow to browse PHP documentation directly from within Emacs