Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. You need to use the SMTP settings, not the POP settings.
  2. How exactly are you getting and displaying that query error and the query? The error message is typical of a numeric value being empty on the right-side of a comparison (such as userid= or gangID= ) but the query being printed is valid (except for possibly needing a space between VALUES and the ( ). I'll guess that the actual query error is coming from a previous query than the one that is being printed after the error message.
  3. And then, if you have not already done so, you need to add some validation logic to your form processing code to prevent rows having empty values from being inserted.
  4. Every http request that is serviced takes some server resources and invoking the php language engine to parse the file requires even more resources. It is customary to put php include files into a folder that is outside (closer to the disk root) of your document root folder so that no one can make a http request for the files or if that option is not available to you, put them into a folder inside your document root folder but also put a .htaccess file (Apache only) into the folder that prevents (Deny) http requests to all the files in that folder.
  5. You need to use mysql_num_rows to find out how many rows there are in the result set. The if(){} conditional test you have now only checks if the query executed without any errors or failed and the posted query will only fail if $_POST['comment_id'] is empty. $result will either be a FALSE value (the query failed to execute due to an error) or a result resource (the query executed without any errors) anyway so empty($result) will always be false.
  6. He already tried that. $_SERVER['DOCUMENT_ROOT'] does not normally include the trailing slash and on shared web hosting it does include your account-name/domain-name as part of the path.
  7. Here is the $64,000 question. Is /var/www/html/ correct for your account on the server - The bolded part is what is returned from $_SERVER['DOCUMENT_ROOT'] A lot of web hosts don't set up the vhosts correctly so that $_SERVER['DOCUMENT_ROOT'] is populated with the value for your account. Given that your value ends with a / and nothing related to your domain/account, you should talk to your web host about this. If they won't or don't know how to fix the setting, you can also set it to the correct value at the start of your script (once your script is running, it is just a variable and can be assigned a value like any other variable.)
  8. Correct. In fact if a new upload is started while an existing one is in progress, the status of the new upload replaces that of any previous upload. In order to display the upload status for a specific uploaded file in the correct client, it would in fact require that the client know and supply a unique identifier with the HTTP requests being made to fetch, update, and display the status. On the server, this unique id would used to retrieve the correct upload status that APC would (future tense, it currently does not do this) maintain for each file concurrently being uploaded. The file name could be used as the identifier, except if two people happen to be uploading a file with the same name at the same time.
  9. You would need to provide a specific example of what values are not working and the code that produces the problem. Uniix timestamps are problematic for several reasons. The biggest one is that you must convert them into a human readable form at some point in time. In php or mysql, unless you use the GMxxx functions, this conversion is dependent on the timezone your web server or mysql server has been configured for (php and mysql have separate timezone settings) at that time the conversion takes place and it is also dependent on an accurate DST setting. Many locations have been changing the DST start and end dates. Both php and mysql have separate DST databases that must be kept up to date in order to give a correct conversion. I don't know if the conversion errors you got in your code were due to different timezone settings at the time the dates were stored vs when they were retrieved (perhaps even using GMxxx functions at one point and non GMxxx functions at another) or if your DST start/end changed at your timezone setting and your DST database(s) is not up to date or if you are doing date/time math by adding a fixed number of seconds per day that does not take into account the loss/gain when DST changes, but all of these conversion problems can be avoided if you don't store date/datetime values using Unix Timestamps. If you store them using DATE (YYYY-MM-DD) or DATETIME (YYYY-MM-DD HH:MM:SS) data types, they will always be the value you store. No conversion is necessary to use them and to just change the format (which is not the same thing as converting the value to/from a Unix Timestamp) to something else (such as dd/mm/yyyy) can be done easily and quickly.
  10. You should be developing and testing code on a development system, not a live server.
  11. $HTTP_GET_VARS was depreciated almost 8 years ago, it has been turned off by default in php5, and it has been completely removed in php6. Use $_GET The php code is not checking for any of the possible upload errors - http://www.php.net/manual/en/features.file-upload.errors.php so it will be a little hard for anyone to tell you exactly why your code is not working for the movie files. I'll guess that if you added some error checking logic to your code that you would get an uploaded error value of 1, meaning that the file exceeded the upload_max_filesize setting.
  12. To just output an image as is, use readfile after the Content-type header. You will also either need to store the correct content-type with each image (assuming the can be different types) or you will need to test the file extension to determine the correct content-type header to output. Using the GD functions takes a huge amount of server resources because it creates an uncompressed bitmap image of the file. If you are not manipulating the image, there is no need to use GD.
  13. As to the file upload progress that it provides, the last time I looked, it was still single-threaded and could only provide the status for one upload at a time.
  14. You should not create new tables for each different category (i.e. the same type of data that you already have but just with a different value) because it makes it extremely inefficient to manage the information OR to simply search and find any information.
  15. http://www.phpfreaks.com/forums/index.php/topic,273977.msg1294735.html#msg1294735
  16. Php variables only have meaning when used in php code. You would need to post your code for anyone here to be able to figure out why what you are doing does not work and to point out how you would need to do it. It is generally a bad idea to let the user enter any table name used in a query or to specify the name of a table to be created because you must validate exactly what has been entered since you cannot use standard methods to protect against sql injection in variables that are use to hold table or column names.
  17. The code you posted in reply#1 produces a drowdown menu from 2000-2009 when called with no parameters. How are you calling that code?
  18. Just because you can do something in a programming language, does not mean you should do it. Variable variables are three times slower than using array variables. In almost every case where you have a set of data that you could access using variable variables, an array should be used and would result in the most efficient code.
  19. At least look at the line where the error is being reported at - $result = mysql_query($sql,connection) or die(mysql_error()); The second parameter of the mysql_query() is the link resource. Your's is missing the $ in front of connection, making it a defined constant instead of a variable holding the link resource from your mysql_connect() statement.
  20. In order to put the result of the sprintf() into the mysql_query, the mysql_query would need to come after the springf() - $sql = "INSERT INTO tophotdeals (title, deal_link, mobile_deal_link, submit_time, hot_time, temperature) VALUES ('%s','%s','%s','%s','%s','%s')"; $query = sprintf($sql, mysql_real_escape_string($title[1][$i]), mysql_real_escape_string($deal_link[1][$i]), mysql_real_escape_string($mobile_deal_link[1][$i]), mysql_real_escape_string($submit_time[1][$i]), mysql_real_escape_string($hot_time[1][$i]), mysql_real_escape_string($temperature[1][$i])); mysql_query($query); The syntax error you were getting was because the closing ) was missing on the mysql_query(... statement.
  21. The most apparent problem is that variable names cannot start with a number. Are you developing and testing php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php would help you by displaying all the errors it detects? You will save a ton of time.
  22. For more than one or two pieces of data, I would use sprintf as demonstrated at this link - http://www.phpfreaks.com/forums/index.php/topic,273584.msg1292539.html#msg1292539
  23. There is an extra single-quote at the end of your original query that is breaking the syntax of the sql.
  24. See the <img tag information in the thread at the following link - http://www.phpfreaks.com/forums/index.php/topic,274110.msg1295438.html#msg1295438
  25. Post your code in that other file showing what you are doing. You cannot output a header or image data on a web page after you output any HTML or any other characters on the page.
×
×
  • 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.