-
Posts
5,448 -
Joined
-
Days Won
174
Everything posted by mac_gyver
-
i've looked at your code and all the form elements in the repeat section need to be made into arrays - i.e. add [] to the name = " ... " attribute. name="product_name" becomes name="product_name[]" this will submit an array of data for each field that you can loop over in the server-side code.
-
unfortunately DreamWeaver must have thought it would be funny to put part of the sql syntax in with the data values and part of it in the actual sql statement. you need to remove the single quotes from round the %s that are in the sql statement or stop using DreamWeaver's functions in your code and write you code yourself. the direct answer to your title is don't depend on DreamWeaver to write code for you. programming is a 'brain-on' activity. you must know the meaning of every character that is in every line of code. what it means, why it is there, and how it contributes to the goal your code is trying to achieve. the reason only the last set of data from the form is inserted is you have no server-side php code to do anything but to insert just one row. i'm not even sure your client-side code is producing anything that you could loop over. your first task would be to debug and make sure your client-side code is sending the data you want. add the following debugging code in your server-side script to display what is actually being submitted - echo '<pre>',print_r($_POST,true),'</pre>';
-
what have you done to troubleshoot the problem? what does $_SESSION['security_code'] contain?
-
in one of the other help forums where you posted this, someone showed you specifically how to reference the ['browser'] field of the array. exactly where are you stuck at in doing this basic task? what have you tried?
-
php dynamically produces dynamic web pages. so, yes, if you want to style the output that php produces, you use css, the same as if you weren't using php to produce the web page.
-
you need to target the method being used to post the spam. i.e. make it easy for your actual members to make legitimate posts. make it harder for the spam to be posted/displayed. if you allow unregistered/unlogged in guests to post (i.e. a shout-box, comments without first having an account), of course you will get 1000's of spam posts. only registered/logged in members should be allowed to post anything. if this is occurring from your registered/logged in users, you need to disable their account as soon as possible after they begin posting spam. if it is too easy to register new accounts, you need to make it harder to use automation to create new accounts. the registration must be verified via a link sent to the supplied email address and you must have a ban system that can ban specific accounts, email addresses, and ip addresses or address ranges. next you need to target the specific form that the spam takes. if the spam are links and/or keywords, you need to add a module that prevents posting links by members that don't have some minimum number of posts and a module to detect/filter common spam keywords. if the problem is so bad that a large percentage of new accounts are spammers, you need to (at least temporarily) fully moderate (don't display the comment until approved by a moderator) all posts for all members that don't have some minimum number of posts. i'm sure there's some module that does this.
-
php is a web server scripting language. you must have a web server installed (Apache is the easiest to use) and php installed on the web server. there are all in one packages with Apache/php/mysql bundled together that you can install on any current computer.
-
your code has a fatal parse error/syntax error (all syntax errors are fatal and your code doesn't even run) on line 22. if you look at line 22 you can probably figure out what is wrong with it. before you spend any more time working on your code, do yourself a favor and set php's error_reporting to E_ALL and display_errors to ON in your master php.ini so that all php errors will be displayed. you will know if these settings are successful when the code above produces output like - Parse error: syntax error, unexpected '{' in your file name.php on line 22 lastly, the mysql_ database library is not recommend for new code (its being depreciated, soon to be removed) and all new code should be written using the mysqli or pdo database libraries so that you don't need to rewrite your code in the future when the mysql_ functions are removed from php.
-
sans means without.
-
the problem is that your table name contains a special character that makes it look like it's a subtraction problem. A) you should not use special characters in a table/column name unless you know how you would make it work with that special character in the name. B) you should NOT make a separate table for each user.
-
the current error is because mysqli_error( ... ) requires the mysqli connection resource as a parameter.
-
the OP's code is pretty much just some thrown together gobbledygook that doesn't search for what was entered or output anything at all even if it found it. even the 'pagination' isn't using pages.
-
if you test your query you will find that date values the same as $to_data with times greater than zero on that date are not matched. the code that barand gave you using date(created) BETWEEN '$from_data' AND '$to_data' is what you should be using.
- 26 replies
-
this thread reads like the page is being requested twice, once with and once without the get query string on the url or you have multiple different included/required files floating around. posting your entire form page would help (javascript/jquery you have on there could be doing this) and post the current php code. how exactly are you viewing the csv output that is showing the dates in the 05/03/2011 format? setting php's error_reporting to E_ALL and display_errors to ON may also help with the debugging.
- 26 replies
-
you must condition/validate/limit all external data before using it. in the case of a negative page number, that passes through the math in your code and produces a negative starting row number in the LIMIT clause, which is invalid and produces a query error. since the query doesn't run at all, you are getting an error when you try to use the fetch statement. this also indicates you don't have any error checking logic for your query. if your query fails with an error, don't continue running code that tries to use the result from the query. you need to insure that the page number is greater then or equal to 1 and you should also insure that it is less than or equal to the maximum page number (this condition won't produce an error, but the query won't ever return any rows.)
-
if the $departTime[$a] - $departPlace[$a] - $arriveTime[$a] are multiple segments belonging to one trip, they don't belong in any of the queries you have posted above because they belong in a separate table, such as a trip_details table, one row per segment and they use the trip log id to associate them with the trip they are part of. your trip log table should contain global/one-time information for each trip. any information for a trip where there are multiple sets for any one trip belong in a separate database table.
-
the problem isn't the method. you are getting an upload error due to the size of the file and your php settings. see this link - http://uk.php.net/manual/en/features.file-upload.errors.php
-
if you want to do this to learn something about OOP, i recommend creating a general purpose CRUD ( http://en.wikipedia.org/wiki/CRUD ) database class using pdo prepared queries. you would then call the methods of this class from your application to run the queries you have shown in your code. you would form the queries and an array of the data types/values in your application code and pass them into the CRUD class methods. the Create (insert) method would be for running an INSERT query.
-
the code i posted in reply #3 would have helped determine why the tmp_name is empty. did you try that code?
-
@Q695, sorry to pick on more of your replies, but the OP already has an upload script. he needs help finding out why it produces an error when trying to copy the uploaded file. posting a link to an upload tutorial with code that is no better than what the op has now, isn't specific to the problem.
-
shared web hosting would allow you to use a local php.ini also, if the code acts like it doesn't have a fatal parse error in the main file, you can set php's error_reporting/display_errors in the code. edit: the only obvious thing wrong with the code now is you are not using the $find variable in the queries. you have the literal string find (missing the $ to make it the variable.)
-
the code you posted isn't running the insert query, unless you didn't post all the relevant code.
-
@Q695, a number of your replies in threads have nothing to do with the problem in the thread. are you even reading and understanding what is being asked?
-
mikk809h, Phear showed you some troubleshooting logic in the hope that you would show us the output from it so that we could see how your submitted data is organized. you still haven't shown how you are submitting multiple sets of data, so you haven't gotten anywhere with this problem. you either must use an array name for your form fields (preferred method as it allows any number of data items in the set) or give each one a unique name (not preferred as it takes more code to keep track of the unique names).
-
the reply by Q695 has nothing to do with your problem. it's not even where the error is occurring at.