-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
The php.net documentation, see this link - fgetcsv , contains an example showing how to loop through the contents of a file.
-
php code show in the browser
PFMaBiSmAd replied to plusnplus's topic in PHP Installation and Configuration
It would take less than 5 minutes using a programming editor like notepad++ to globally search/replace all the files in your project's folder (using the replace in files menu) and you will never have this problem again. You have probably spent 4-5 orders of magnitude more time on this problem already than what it would take to fix it. Search and replace - 1) <? to <?php 2) <?phpphp to <?php 3) <?php= to <?php echo 4) Done! -
php code show in the browser
PFMaBiSmAd replied to plusnplus's topic in PHP Installation and Configuration
It would help if you showed what opening php tag you are using in your code. -
^^^ Backup your database, then simply add a new column of type DATE. Perform one UPDATE query using the mysql STR_TO_DATE() function in it (a query without a WHERE clause will update all the rows at once) to populate the new DATE column from your existing data. Remove the old 11/04/2009 format column. You can do this using your favorite database management tool, no php code is necessary. ^^^ You can convert your 11/04/2009 format date into a DATE type when you insert/update it using the STR_TO_DATE() function directly in your queries. You can retrieve a DATE type in any format you want by using the DATE_FORMAT() function directly in your queries. Other than editing your queries, you don't need to change anything.
-
You can only do greater-than/less-than date comparisons when the dates are formatted, left-to-right, most significant field-to-least significant field or have an integer representation where the magnitude of the integer allows greater-than/less-than comparisons. This is one of the reasons why database DATE data types are formatted YYYY-MM-DD. Your first step will be to use a DATE data type.
-
In your code, when the query fails due to any kind of error, you don't do anything, so you don't know that an error occured. Also, inet_aton() is a mysql function in the query statement. It does not get enclosed in single-quotes as that would make it a piece of string data - the characters - i n e t _ a t o n ( ... in a string.
-
Considering that you just put in the inet_aton() function, yes you did change something.
-
You have single-quotes around your table name, making it a string rather than a table name.
-
Your query is only SELECTing id in the query, so the data in the other columns is not available. You would need to select the columns that you want.
-
Ip addresses are not numbers. They are made up of numeric digits and periods to separate the different parts. You either need to store them using a character/text type or convert them to a number (see the mysql INET_ATON() and INET_NTOA() functions.)
-
If you want help with some of your code that is not working, you would need to post your code.
-
how to get data between two same dates when datefield is DATETIME
PFMaBiSmAd replied to SUNIL16's topic in MySQL Help
You need to just use the date part of ACTIVITY_DATE - ... WHERE DATE(ACTIVITY_DATE) BETWEEN ... -
That section of code would need to look like - <select name="Averhuur"> <?php // $Averhuur contains the submitted value or '' for($i=1;$i <=5; $i++){ $select = ($Averhuur == $i) ? ' selected="selected"': ''; echo "<option value=\"$i\"$select>$i</option>\n"; } ?> </select>
-
That's because that code is nonsense.
-
Once you actually test the result of your query and use the correct $mysql->error code to find why it is failing, you will find that your query makes no sense. You are apparently trying to make a mulit-table INSERT query and there is no such thing. The following is the syntax definition for an insert query -
-
$insert holds your query statement, which is a string, which is a TRUE value, so if($insert){ will always be TRUE. You need to test the value returned by $mysql->query($insert) in order to test if the query executed or failed.
-
For a select option - http://w3schools.com/tags/att_option_selected.asp For a checkbox/radio - http://w3schools.com/tags/att_input_checked.asp You need to add logic that tests the value and outputs the necessary HTML to cause the correct choice to be selected.
-
Trying to insert to a database with a passed value and a form
PFMaBiSmAd replied to fufaso's topic in PHP Coding Help
Your form processing code is being executed unconditionally every time the page is requested, so of course a blank $cmt is inserted when you first browse to the file. -
You can't. Your host should have provided a way of upgrading your account to php5, either through a control panel choice or through a setting in a .htaccess file.
-
You are still using php4. The end of life of php4 was nearly 4 years ago. Time to upgrade.
-
$insert isn't your query string. It is the result of a $mysql->query("....") statement. What did you actually intend your code to do?
-
Receiving POST data through proxy (paypal IPN listener)
PFMaBiSmAd replied to kirkh34's topic in PHP Coding Help
http is the protocol. www is the hostname/sub-domain. Perhaps if you were using https and/or the URL without the www on it? So did you actually try browsing to the URL on the shared web host so that you know that the URL is pointing to the correct server? -
Receiving POST data through proxy (paypal IPN listener)
PFMaBiSmAd replied to kirkh34's topic in PHP Coding Help
Can YOU browse to the listener script, on the shared hosting, using the EXACT URL (protocol, subdomain/host name, domain, path, and document name) that you have entered in the Paypal IPN settings and get the script to execute? Any chance in your submission to paypal that you are overriding the listener URL with a url that does not exist? -
You need to make your function recursive. See this recent post - http://www.phpfreaks.com/forums/php-coding-help/best-way-to-clean-a-lot-of-inputs/msg1498920/#msg1498920
-
GROUP is a reserved keyword, as in GROUP BY... You either need to rename your column to something else or you must enclose it in back-ticks `` every time you use it in a query.