Jump to content

zeodragonzord

Members
  • Posts

    104
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

zeodragonzord's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. setTimeout() only runs once. You might be thinking of setInterval(), which runs repeatedly. However, if you're using setTimeout() to submit a form back to the same page, well then your page will just run setTimeout() over and over again on each page load. I just tried this out and this works. <script type="text/javascript"> function submitForm() { document.forms["theFormName"].submit(); } setTimeout("submitForm()",2000); </script> <form name="theFormName" id="theFormName" action="receiving_page.html"> <input type="text" name="field1" id="field1" value="field1value"> <input type="text" name="field2" id="field2" value="field2value"> </form>
  2. Multi-row deletes work because you put a condition on rows that exist using the WHERE clause, "Delete from the table that matches these conditions." With basic inserts, you don't have a condition, you're just adding a row of data. You could however insert multiple rows at once using this format and run this statement once: INSERT INTO hitlist(hit_id, player_id) VALUES (field1data1, field2data1), (field1data2, field2data2); AyKay47's code accomplishes this.
  3. Not sure exactly what you're trying to do, but I noticed a few issues with this code. First, anything within brackets {} should contain option:value that Spry allows. "VALID" is not valid. Second, your second variable has the same name as the first one, sprytextfield5; you probably meant sprytextfield9. What is considered valid for that field? http://labs.adobe.com/technologies/spry/articles/textfield_overview/
  4. Try creating two CSS styles, one for showing the element, one for hiding. Use JavaScript to switch the styles. CSS: .show { visibility: visible; } .hide { visibility: hidden; } JavaScript to set class names for showing/hiding: document.getElementById(a).className="show"; document.getElementById(a).className="hide";
  5. Can you post the script?
  6. You can use a combination of the submit() and settimeout() JavaScript functions. This is untested, but you can try something like this. function submitForm() { document.forms["theFormName"].submit(); } setTimeout("submitForm()",5000);
  7. When you say it's just inserting one user, do you mean it's only inserting one row? Also, $playerID is not set anywhere before it is used in your INSERT statement.
  8. Are there any good PHP web applications that will allow me to upload and manage files onto my FTP server? For example, I'm in a band and would like to have a web application to be able to upload my music source files, put in some notes, e.g., "Added new drum part." I could use regular FTP but I wanted to check if there are any other options. Thanks.
  9. I'm writing an application with many classes. Some of these classes interact with MySQL with methods doing specific things like inserting, updating, etc. I use Pear MDB2. Where is the best place to generate a MDB2 object? Should I: create the MDB2 object in the constructor and assign it into the object variable to be used in each of its methods create the MDB2 object inside each method create the MDB2 object and pass it into the object in its constructor create the MDB2 object in a config file and use the global keyword to access it in each object I originally had a singleton used inside each method but I don't like the idea that the singleton database connector is global. Thanks.
  10. You use $_POST to get the form values from the previous page. I noticed that on your login form, the action is set to indxlog.php. However, you're using check.php to look for the $_POST form values from the login page. The indxlog.php will need to get the $_POST values. If you do a var_dump($_POST) in indxlog.php, you should see the form values there. The indxlog.php page should be the one to check if the username is valid and then set it to the $_SESSION if valid.
  11. Perhaps this can help. Not the best code I've ever written but it should work in your case. $select_field = "<select name='active'>"; if(getstaff1['active'] == 1) { $active_1 = " selected"; $active_0 = ""; } else if(getstaff1['active'] == 0) { $active_1 = ""; $active_0 = " selected"; } else { $active_1 = ""; $active_0 = ""; } $select_field .= " <option value='1' $active_1>Yes</option> <option value='0' $active_0>No</option>"; $select_field .= "</select>"; andrewgauger definitely has the better answer if you're able to do inline PHP.
  12. Are you looking for something like this? This represents how many times each student shows up in week1. I didn't see a username column in the table. This query would be a problem if you have two students with the same exact username and last name. Table will show [first_name][last_name][count] SELECT first_name last_name, count(*) FROM students GROUP BY CONCAT(first_name, last_name) WHERE week1 = 'y'
  13. Try this... SELECT *.companies FROM friends INNER JOIN employees ON friends.whom = employees.userid INNER JOIN companies ON employees.companyid = companies.companyid;
  14. First of all, do you have indexes on your tables? Apply indexes to the fields you'll search by. Is searching with options optional? If so, you can build the INNER clause to the option table only if the user selects an option with the search. User selects a product in the search SELECT * FROM products WHERE ..... User selects a product and an option in the search SELECT * FROM products INNER JOIN options ON products.product_id = options.product_id WHERE ... The INNER JOIN will enforce that the product_id will need to match in both tables for it to show up in the result.
  15. Check the spelling of the value you are comparing. I noticed that Wolphie gave an example using "product" but your code has "products". See if that's it.
×
×
  • 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.