Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. You must use a HTML <img ..> tag to display an image on a web page (it's the browser the requests the image from wherever it is at and renders the image on the page.) See this recent thread for an example of someone doing this for their images stored in a database - http://www.phpfreaks.com/forums/index.php?topic=328757.0 You would put your GD code into the .php file that is put into the src="..." attribute. You would need to save the randomly generated number in a session variable so that it is available to the form processing code.
  2. NOT this problem again. A few of the browser makers decided to do something outside the w3.org specification and send the name/value attributes when an image is used as a submit button. Opera and IE follow the w3.org specification to the letter. The w3.org specification states that for a successful form submission that only the x and y coordinates where the images was clicked are sent. AFAIK, all browsers send the x and y coordinates like the specification states. You can either test for the x or y coordinate (which php will receive as $_POST['name_x'] or as $_POST['name_y'], where name is the name="..." attribute) or you can using a hidden field with a name/value that you choose or you can even use a get parameter on the end of the url that you can test. See this link - http://us2.php.net/manual/en/faq.html.php#faq.html.form-image
  3. $result is either a FALSE value (if your query failed due to an error of some kind) or a result resource. If your query executes without any errors, you will get a result resource, that may or may not contain any row(s). After you test if the query executed without any errors, you would need to use mysql_num_rows() to find out how many row(s) the query matched.
  4. Are you just selecting/inserting rows with this many columns or are you actually "create(ing) around 500 columns in a table"?
  5. Your (current) image1.php code will still be producing a fatal php parse error, due to missing {} around the $_GET['id'] in the query (you had these in your original code.) $query = mysql_query("SELECT image FROM photos WHERE id={$_GET['id']}");
  6. In the meantime, you can loop through your individually named fields by concatenating a php variable to form the index name - $_FILES['multimedia_'.$i]
  7. And, your image1.php code contains an extra } that would be producing a fatal php parse error and no output at all. Remove that stray } at the third line from the end of the file.
  8. I cannot get your form to FAIL on my server (Windows development system.) Even when exceeding the post_max_size setting, the server-side $_SERVER['CONTENT_LENGTH'] is the correct/expected value that matches what was selected in the form, with empty $_FILES and $_POST arrays. I'm going to guess this has something to do with php on your specific server. The only thing I can see in all this is I would turn on display_startup_errors
  9. While I am looking at/testing your form, does it WORK using the uniquely named (non-array) input fields? Are your $_POST and $_FILES arrays both empty when this problem occurs? Also, AFAIK multiple="true" in that type of field is invalid and should be removed. I would also validate the HTML of your form page at validator.w3.org You have id="..." attributes in those fields, implying you have some javascript referencing the values. Any chance your javascript is doing something to the fields?
  10. That's because you cannot output an image directly in the HTML on a web page, primarily because you cannot output a header() in a HTTP request after you have sent any content to the browser. You must use an HTML <img> tag, because it is the browser that requests the image and renders it on the page. Your original concept was correct, but it has some errors in it. In your image2.php code, you have a mis-placed " in your <img> tag. Use the following line of code - print '<img src="image1.php?id='.$row['id'].'" height="75" width="100">'; Your image2.php code has several problems - 1) You would need to use $_GET['id'] as that is the name of the GET parameter you are putting on the end of the url ?id=123 2) You need to both cast $_GET['id'] as an integer and test that $_GET['id'] has a number in it to prevent sql injection and to prevent sql errors in your query. 3) You apparently have typo in the column name in your query. imgage should be image 4) You should store the image type image/jpg in a column in your table so that your code will support other image types. You would retrieve that value when you retrieve the image data and output it in the Content-type header().
  11. Read the last reply in this sticky post - http://www.phpfreaks.com/forums/index.php?topic=37442.0
  12. The following is the syntax prototype for a SELECT query. The required position of the ORDER BY term is in red -
  13. The information at the link I posted above tells you what that error means. There's at least three different size related errors ($_FILES will be empty for one of them and you will get an error value of 1 or 2 for the other two) and there's a handful of other errors that can occur that are out of your hands, such as the visitor not selecting a file or aborting the upload part way through. If you are not going to put error checking logic in your code to get your code to only process the uploaded file when it has been successfully uploaded, you are going to constantly be faced with code that does not work under some conditions. No matter what you change the settings to, someone CAN and WILL attempt to upload a file that is larger than what the settings are and if you set them to outrageously large values, some hacker is going to use that to bog down your server and get your account suspended by constantly uploading huge files. Make your code user and server friendly by using error checking logic in it.
  14. Your code has absolutely no error checking logic in it to test if the upload worked before you attempt to access any of the uploaded file information. At a minimum you need to test that the $_FILES array is set (use isset($_FILES) and that $_FILES['get_song']['error'] is a zero value - Please read the upload handling section of the php.net documentation - http://us.php.net/manual/en/features.file-upload.php
  15. You are going to need to post enough of your code that demonstrates and reproduces the problem, i.e. your whole form page and any php pages that are referenced by that page. Just posting bits and pieces taken out of context doesn't help because that doesn't show how the code is being called or what it operates on. xxxxxx out any sensitive information in your code, but to get the quickest solution, you need to post all the code that is relevant to this problem.
  16. LOL, you are back at the point of needing to read and follow the first two replies in the last thread you started for this code - You need to put the error_reporting() statement after the line with the first <?php tag and before any other code so that you will see ALL the errors.
  17. You would add an ORDER BY column_name term to your query to return the rows in the order that you want them.
  18. imagecolorallocate() returns an integer and the first call to it returns a zero value which will trigger the or die() statement. There's even a warning in the documentation about how to test the value that is returned - Don't use or anything() to test if the function call failed. Use a proper if() statement.
  19. See this link - http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group-row.html
  20. An Undefined variable: num1 in ... error would be coming from code that is referencing a variable named $num1. Something like - $abc = $num1;
  21. Then the actual code where the error is occurring at is not what you have posted or the file where the error is occurring at is not what you have posted or the error is occurring before a form has been submitted, not after...
  22. You can set the error_reporting/display_errors settings in your script. Doing so will show most of the errors, except for fatal parse errors. Also, you should not be trying to learn php, develop php code, or debug php code on a live server because you will waste a TON of your time constantly uploading code just to see the result of each change. You need to set up a local development system on your computer. This will save you countless hours of your time.
  23. Are you sure the error message isn't - Notice: Undefined index: num1 in ... The code you posted would be producing an undefined index error, not Notice: Undefined variable: num1 ... The code you have been posting might be where the symptom is showing up (no values in the field) but that code is being executed (the form has those fields) and doing what it is supposed to be doing, but the variables shown in it don't have any value. Your problem is somewhere before that point, either in the query or in the code that is retrieving the data from the query and putting the values into the expected variables.
  24. ^^^ That occurs when php is NOT running as an Apache Module.
  25. You would need to send the email as a HTML email with the proper character set selected in the mail header field. See example #4 at this link - http://us3.php.net/manual/en/function.mail.php I also recommend that you form the subject, message, and header fields in php variables and then simply put those variables into the mail() function call. It will make writing and reading your code a lot easier and clearer.
×
×
  • 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.