Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. The uploaded file information is not held in the $_POST array, so using $_POST['images'] in any way has nothing to do with uploading files.
  2. $_POST['images'] has nothing to do with uploaded files. Stevis2002, in your last thread for this problem, YOUR code is closer to what you actually need then anything that has been posted in this thread. Why did you start a new thread and throw away all the information leading up to this point and why did you remove the existing code in your code that was getting the $_FILES information for the 1st file?
  3. Your first step will be to define how you are going to store multiple upload images and associate them with the correct information in your database. Once you have done that, the code to loop over the uploaded files, which someone already posted a link to in your existing thread you have for this problem, is the simple part of what you need to do.
  4. Firefox will request a page twice due to using debugging add-ons and at least in the past it would request a page twice if the default character encoding you have set in the browser does not match the character encoding on the page.
  5. In your error checking logic in your script, when the mysql_query statement fails and returns a false value, indicating an error occurred, mysql_errno will be a specific value when there was a duplicate key. I think it is 1062, but you should test to confirm what value you get by echoing mysql_errno in a test script. It's also possible that if you are using the IGNORE keyword in your query that using mysql_affected_rows will correctly indicate if the query actually inserted a row or not, but I don't know this for a fact and you would need to experiment to see if you get the correct indication out.
  6. Your code works for me (clicking on the radio buttons alternates between the nametag field and the other two fields being enabled/disabled and what background color they are.) I'm going to guess that you don't have any elements with id's of 'nametag','first_name', and 'last_name', but since you didn't bother to post code that demonstrates the problem, just a guess. Also, stating what 'doesn't work' means would go a long way toward someone actually being able to help you. We are not standing right next to you and are totally dependent on seeing the code responsible for the symptoms and the symptoms through what you post in the thread.
  7. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=316454.0
  8. ORDER is a reserved mysql keyword (as in ORDER BY...). If you were using some error checking in your code, you would be getting a sql error at that point in the query. Either rename your ORDER column to something else or you must enclose it in back-ticks `` every time you use it in a query.
  9. When you do a 'view source' in your browser, is the HTML/Javascropt present and correct? Are you calling the logreg() function in your HTML? Posting enough of your code that produces/reproduces the problem is the fastest way of getting a solution. And, php is a server side scripting language. It outputs content (HTML, Javascript, CSS, media) to the browser. The HTML/Javascript is not technically HTML/Javascript until the browser receives it and renders the HTML and executes the Javascript. As long as the content that php outputs to the browser is valid, this is not really a php problem.
  10. You simply make the email and site_id columns a composite key.
  11. The src="..." attribute of the <img > tag is a URL. The browser requests the image and displays it on the page. That's the way images work on web pages and that is the way you need to do it.
  12. You also have an extra comma after the street_address,
  13. Another alternate 'fix' would be to append/prepend the % wild-card character to the data value before (or while) calling the GetSQLValueString() function for the specific parameter in the query that is being put into the LIKE '...' term.
  14. Unfortunately, the DW GetSQLValueString() function puts the single-quotes that are part of the SQL syntax for strings around the value it returns, rather than YOU putting the necessary SQL syntax in the query. You would either need to remove the leading and trailing single-quotes that are being put around the value that GetSQLValueString() returns or you will simply need to escape the string data values yourself by using mysql_real_escape_string instead of the GetSQLValueString() function.
  15. mysql_affected_rows does not use the value returned by such a query (which is only a TRUE/FALSE value.) It optionally uses the connection link resource. I'm thinking that you would be getting a php error about the parameter not being a link resource if you were doing this on a system with error_reporting set to E_ALL and display_errors set to ON.
  16. LOL, this thread is almost identical to one from a few days ago, where it was necessary to point out to the OP that it is human nature, when trying to help someone, to suggest better ways of accomplishing a task (i.e. quicker, simpler, less code, less memory, more flexible, more reusable...), especially when the reason you are asking a specific group of people is because you want to benefit from their experience in a subject. To the OP, if all you were interested in is finding "what the proper syntax is" for something you were doing, you should probably not be asking a group of programmers for help, especially if you are overlooking the posted answer as something that didn't matter. You should be researching the information yourself in the documentation.
  17. Your form data is already in an array, either $_POST or $_GET, depending on the form's method="" attribute. You should however have a master array that contains a list of the expected field names so that you can iterate over the expected fields and detect/ignore any that a bot script or hacker is attempting to send that are not part of your actual form.
  18. It has two problems that I can see - 1) All the unnecessary opening and closing php tags. 2) Using both the traditional and alternative control structure syntax (which by the way, takes more typing in every case than using the traditional syntax.) Fixing both of those would at least make it readable.
  19. Is the query producing a mysql error or does it simply return zero rows? What is the data type of the type column? Have you attempted to execute the query directly against your database using your favorite database management tool (phpmyadmin or similar)? Have you confirmed that you have a matching row(s) in your table?
  20. You can make a WHERE clause with any number of conditions in it, as long as it makes logical sense and does not exceed the maximum length of a query statement (default is 2M bytes if I remember correctly.) If you have a query that you need help with, you would need to post it.
  21. What we are suggesting using an array - $thePill['Blue'] = 'some value for Blue'; $thePill['Red'] = 'some other value for Red'; ... $color = 'Blue'; // value retrieved from your database table... echo $thePill[$color]; // outputs 'some value for Blue' And given that your example changed radically from the first post to the last post, what are you actually trying to accomplish?
  22. So, are all you guys/gals that are asking this same question taking the same programming class? This is like the 5th thread on this subject in the past day. If your instructor is using an example or is suggesting creating either a series of named program variables or creating program variables who's name is from a value in a database table, suggest back to him/her that THEY SHOULD BE TEACHING HOW TO USE ARRAYS. Blindly polluting the main program variable space based on database table column names or names held as data IS BAD because now you must keep track of what variables your program is using AND the names of columns/data values in your database so that you don't overwrite your main program variables simply because you forgot and added a column or saved a value in your table that you are already using as a variable. Short answer: You should be using an array, not a series of named variables to hold a set of related data. Arrays are for sets of data.
  23. If there's no php code in the files, you can simply use file_get_contents and then just echo the $content any where you want. file_get_contents, like any function, can use a variable as the parameter when it is called. Once you get the file name in to a variable, you can do the following - $filename = 'whatever.php'; // get the correct name using your id to name lookup code $content = file_get_contents($filename);
  24. Is there actually php code in the 'marc.php' type files or is it just some text content that you want to place into the HTML on your page? And, is there a reason you are not using a database for this?
  25. I'm not sure what you are trying to do, your question is not clear, but is seems to be related to having individual included content for each id/name? Could you indicate how your $id relates to the file.php include() statement? However, you should not use a series of if/else if statements to lookup values when there can be an arbitrary and changing number of values. Use something like the following to replace your if/else if code - <?php $lookup = array(); $lookup[1] = 'Marc'; $lookup[2] = 'Glenn'; $lookup[3] = 'Nathan'; $lookup[4] = 'Scott'; // add other key/value pairs as necessary $id = isset($_GET['id']) ? (int)$_GET['id'] : NULL; // get input value (or NULL) // lookup value in array if(isset($lookup[$id])){ $id = $lookup[$id]; } else { $id = NULL; } ?>
×
×
  • 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.