-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Your form must be invalid (i.e. some of the form elements outside the <form></form> tags.) It would take seeing your actual form for someone to be able to help you.
-
The code you posted is just way out of date AND it has absolutely no error checking logic, no error reporting logic, or error recovery logic in it to get it to check if the upload worked or failed, tell you why it failed, and take an appropriate action when it fails. For debugging purposes only, to find out what is happening on the server, add the following code starting on the line right after the first opening <?php tag - ini_set("display_startup_errors", "1"); ini_set("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>";
-
The doctype is HTML. It is in fact the daddy html tag that tells what kind of html the page contains. It's also not a comment <!-- --> and if it was, that is a HTML comment, which is html, which is something that is output to the browser.
-
Mysql_query() does not support multiple queries separated by semi-colons ; so the example you posted would not likely be a problem (you could always test it on a development system.) However, for numeric data (which is what an id is normally used for in a query), if you are not validating or casting the entered number as an integer it is possible to inject sql that contains no quotes in it (i.e. a string that is encoded as a HEX value) that mysql_real_escape_string() won't protect against. You can for example inject a UNION query that will show all the usernames and passwords in your user table onto a typical SELECT query. The following can still have sql injected - $id = mysql_real_escape_string($_GET['id']); $query = "SELECT * FROM your_table WHERE id = $id"; The following cannot - $id = (int)$_GET['id']; $query = "SELECT * FROM your_table WHERE id = $id";
-
It's because you are supplying a day number date("d") that does not exist in the month being referenced. Use a 1 in the day number position.
-
It has nothing to do with sessions and in fact I did not even mention the word session in my reply. There are countless 'who is online' php scripts posted around that show how to add/check/remove records from an 'online' table - http://www.google.com/#hl=en&source=hp&q=php+who+is+online+script&aq=0&aqi=g1&aql=&oq=php+who+is+online&gs_rfai=&fp=bcdf8cbbf06dc4f
-
No data inserted into database. Am I wrongdoing it?
PFMaBiSmAd replied to pollysal's topic in PHP Coding Help
Your original problem is because the php code you have placed in your form is executed unconditionally when the form is displayed. this is what inserts a blank row. When you submit that form, either your code in BookingForm.php is setting the $_SESSION variables or register_globals are on and the $_POST variables with the same name as the $_SESSION variables are automatically setting the $_SESSION variables (which is why register_globals where turned off by default a really long time ago to prevent hacker from being able to set $_SESSION variables.) Since you are using two different pages for the form and the form processing code, the php code that you have in the form page should be removed. The php code in the form processing page is what needs to perform the INSERT query. -
That has nothing to do with his problem. He is getting output up to some point on the page and the output buffer is automatically flushed when the php script ends.
-
You should make the Username column a unique key to prevent that. You need to store the 'last access' date/time in the online table as well. You would UPDATE the last access date/time on every page request to keep it current. You can then check and remove records in the online table that have a last access date/time older than a value you pick (typically 10-20 minutes is used.)
-
What does a 'view source' show you? You probably have something like an exit; statement being executed in one of the included files. Did you troubleshoot what your code is doing from the point where the last output is occurring up to the point where you are not getting any output?
-
What exact output are you getting? If it is a blank page, what does a 'view source' in your browser show? If you are getting a completely blank page, you likely have a fatal parse error (probably something in one of the included files.) Are you developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your php.ini so that php would display all the errors it detects (just setting those two values in your script only shows runtime errors.)
-
You need to keep back-tracking through the code. At the point where that function is called, the second parameter needs to be an instance of the class - _parseIridiumTransactionResponse($gateway_output, $transaction_output_message); There is no guarantee that the variable name being used in the function call is that exact same name.
-
// echo "$str<br>"; The code you posted contains that line of commented out code. If the actual code being executed on the server is the version of the code before that line was commented out, the query would be echoed on the web page. Have you checked what the actual code is in the file that is on the server?
-
The error means that $transaction_output_message is not an instance of a class. There should be a line of code like - $transaction_output_message = new some_class_name(); Something is either preventing that line code from being seen at all (it's inside of a conditional statement that is FALSE or inside of an included file that is not being included) or being seen as php code (someone used short opening php tags) or it is not occurring in the same scope as the code where the error is occurring at or something is clearing the $transaction_output_message variable. Setting error_reporting to E_ALL (if it is not already) may help to identify which of those possibilities is causing the problem.
-
After displaying avatar can't display data
PFMaBiSmAd replied to oliver12's topic in PHP Coding Help
After you iterate over the result set, the result pointer is after the last row of data. You must reset the result pointer before you can iterate over the result set again - http://php.net/mysql_data_seek -
Without seeing the code that sets $date and $month and seeing exactly what values are in them at the time the posted code executes, it is impossible to tell you why the code is not working. Does $month contain exactly 'mar' or is it 'Mar' or is it the month number 3? Edit to your edit: Please read the documentation for whatever you are doing in programming. It is simply impossible to write code that works without knowing (or looking up) what a function does.
-
LOL, you only removed the @. That is only one of the three things that needed to be fixed. You still need to do this - And this -
-
In general, you would do this all in your query by forming the absolute value (see the mysql ABS() function) of the difference between the target date and the actual date (see the mysql DATEDIFF() function) and doing an ORDER BY the_difference DESC A difference of zero would mean the date was same as the target date. A difference of 1 (day) would mean that the date was within one day (plus or minus due to the use of the absolute value) of the target date...
-
You would need to lock the table to make that scheme work.
-
Your actual UPDATE query contains a syntax error (an extra comma.) If you look at the SQL you can probably see it. You also have the following line of code that is doing nothing - if (!@mysql_query) The @ is suppressing the fact that php is treating that as a defined constant named mysql_query, then when it does not find one by that name, treats that as the string 'mysql_query'. Since the string 'mysql_query' is TRUE the if(){} conditional statement is skipped. You should not use @ in any code (ever) to suppress errors. Your error checking and error reporting logic needs to test the value returned by the first mysql_query() statement or you need to form the query in a string and put it into the second mysql_query statement (after you fix it so that it is an actual mysql_query() function call.)
-
Does the email message body contain ONLY and exactly what you showed in the first post or does it also contain any portion of - It sounds like there is another mail() function call that is sending the query string, either as part of some custom error reporting or perhaps to notify an administrator of what was just inserted into the database. You need to search through all the code on that page or included/required by that page to see if there are any more mail() function calls or even if some other method is being used to send mail (such as the phpmailer or pear mailer classes.) Also, are there any set_error_handler() statements?
-
mysql_query() returns a result resource for a SELECT query that executes without any errors, not actual data. You must fetch data from a result resource or you can also use functions like mysql_num_rows() to find out how many rows are contained in a result set. These are the basics for using php/mysql that are covered in all the books, tutorials, and the php.net documentation for what you are attempting to do.
-
@zeodragonzord and @Zanus Under modern interrupt driven multitasking operating systems (i.e. current ones ) and also in situations where one or more servers are making use of a separate database server, other quires due to concurrent visitors can occur at any time and you cannot guarantee that executing a separate query to get the highest value will result in the value that was just operated on by the current invocation of a php script. This is why things like the mysql_insert_id() are maintained per connection so that they are accurate for the current visitor regardless of what other queries are being executed. JustLikeIcarus already suggest the best solution for a deliberate UPDATE query. You just updated a specific record and you know which one because you know the WHERE condition that matched that record. You can also put a SET id=LAST_INSERT_ID(id) in the UPDATE query to cause the mysql_insert_id() to be set with the value of the id column that was just updated. If the UPDATE query operated on more than one row, things like mysql_insert_id() only return the first row affected and you would need to individually update each affected row or SET a column to some unique flag value (time values are not unique) that was generated by the php script in order to be able to identify all the affected rows.
-
Cannot help you with your actual problem then. Due to the general purpose nature of programming, 113 different people could have written your tread in this forum with the same symptom and there could be something different wrong in each of their programs.