Jump to content

thefortrees

Members
  • Posts

    88
  • Joined

  • Last visited

    Never

About thefortrees

  • Birthday 10/11/1984

Profile Information

  • Gender
    Not Telling
  • Location
    Virginia

thefortrees's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi all, I am developing an online survey tool for a client and wanted community input or any ideas anybody may want to offer. My problem is this: any user of the system can log in and create a custom survey. This user then creates survey codes to give to others. The 'customers' (people who hold survey codes) log in to take a survey using those codes. The survey needs to be broken up into multiple pages (ie - if there are 25 questions, 5 questions per page, so total of 5 pages). However, if the user does not finish the form and submit it at the last page, then the data should not be stored. I am trying to implement the most efficient and effective design for this application. Currently, I am thinking of using a 'temporary_results' table which would store the interim results before the entire survey is completed. If a user completes the survey, then survey data is stored in a 'final_results' table. Also, every survey page will pass the next question numbers to retrieve from the database to the next form. Any input on this? If anybody has developed an application similar to this before, suggestions or comments would be greatly appreciated!
  2. Hi all, Just wondering what you think is more efficient in this situation. I have three tables: items, promocodes, and items_promocodes. items_promocodes is (obviously) a relational table for items and promocodes. If a promocode is applied to any number of items, each item is stored as a new row in items_promocodes with the related promocode as a field. I want to pull all items from the db and check to see if a promocode has been applied to each one. Which one of these is more efficient? $query_allItems = "select items_id from items"; $res_allItems = mysql_query($query_allItems); while ($row_allItems = mysql_fetch_row($res_allItems) { $query_checkItem = "select items_promocode_id from items_promocode where item = '{$row_allItems[0]}'"; $res_checkItem = mysql_query($query_checkItem); if (mysql_num_rows($res_checkItem) > 0) // Item has a promocode applied to it. } $allItemsPromocodes = array(); $query_allItemsPromocodes = "select items_id from items_promocodes"; $res_allItemsPromocodes = mysql_query($query_allItemsPromocodes); while ($row_allItemsPromocodes = mysql_fetch_row($res_allItemsPromocodes)) { $allItemsPromocodes[] = $row_allItemsPromocodes[0]; } $query_allItems = "select items_id from items"; $res_allItems = mysql_query($query_allItems); while ($row_allItems = mysql_fetch_row($res_allItems)) { if (in_array($row_allItems[0], $allItemsPromocodes)) // Item has a promocode applied to it } Is it more efficient to traverse an (possibly enormous) array or to query a database (possibly thousands) of times? I would guess that the query would be more efficient.
  3. ??? I don't really understand what you are asking. If the array key is the same as one that exists already, the value stored in the array will be overwritten with the new value. What bits of information do you want to echo? Just use 'echo'.
  4. Hi all - I am looking to implement a blog into a site. There are many PHP blog packages out there, so I don't need to code it. Any suggestions on which ones to use? I'm looking at Serendipity and SimplePHPblog right now. Thanks!
  5. Hi all, I am tasked with creating a script that takes data submitted in a form on my site, goes to an external site, and populates the fields. For example, if I am at www.mysite.com, I fill out a form with my data (name, address, etc). On form submission, user is redirected to www.someotherdudessite.com and the fields are populated with data from my form. Any ideas where to start?
  6. Solution: update vehicles set vehicles.vehicles_photo_datein = (select max(photo.datein) from vehicle_photos where vehicles.vehicles_photo_datein is null and vehicles.vehicles_id = vehicle_photos.vehicles_id) where vehicles.vehicles_photo_datein is null;
  7. Hi all, I need help with a mysql query. Explanation of problem - I have two tables, vehicles and vehicle_photos. vehicles --------- vehicles_id .... .... vehicles_photo_datein and vehicle_photos --------- vehicle_photos_id vehicles_vehicles_id .... .... photo_datein There are quite a few rows in the vehicles table that have null values for vehicles_photo_datein. I need to take the most recent datein from vehicle_photos that corresponds to vehicles_id in vehicle with null vehicles_photo_datein. I have tried many combinations of queries and can't get it right. Here is what I started with which doesn't work(and will explain what I want better than a paragraph could) update vehicles v, vehicle_photos vp set v.vehicles_photo_datein = (select max(vp.photo_datein) from vehicles v, vehicle_photos vp where v.vehicles_photo_datein is null and v.vehicles_id = vp.vehicles_vehicles_id) where v.vehiclephoto_datein is null; Thanks!
  8. I write to an XML file, then I import the XML file with Excel
  9. Is there any way to define the line break in hexadecimal? I think it is 0x0D 0x0A
  10. Hi all, I am writing to an XML file using PHP then importing the file into Excel as a spreadsheet. Every thing is working fine EXCEPT... I need linebreaks within a string (ie - one cell) and can not figure out/find how to do this. \n and the like do not work properly. Any suggestions?
  11. Remove @ from before all of your $_POST variables. @ denotes silent mode - it tells functions to not return any message on failure. Try this for $query1 $query1 = "SELECT * FROM speciescomplete WHERE species_id = '$species'"; The error you are getting is telling you that the result from your query is not a valid result, meaning your query is incorrect. You do not have a script set in the form action to run. You need this below echo "<p>"; echo '<form method="post" action="form_handler.php">'; form_handler.php is the filename of the script you need to process this form. Next, take the bottom portion of your code and put it into a separate file. I will call it form_handler.php. $author = $_POST['author']; $distribution = $_POST['distribution']; $size = $_POST['size']; $habitat = $_POST['habitat']; $query2= "UPDATE speciescomplete SET author='$author',distribution='$distribution', size='$size', habitat='$habitat' WHERE species_id=$species"; $result2 = mysql_query ($query2);
  12. Hi all - I am trying to implement the "Son of Suckerfish" drop down menu --> http://www.htmldog.com/articles/suckerfish/dropdowns/. Works fine in Mozilla, but in IE, the drop down menu alignment is off and does not disappear onmouseout. Here is my php function that outputs javascript and html: function indexNavBar($current) { $nav = "<script type=\"text/javascript\">" . "sfHover = function() { var sfEls = document.getElementById(\"navmenu\").getElementsByTagName(\"LI\"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=\" sfhover\"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(\" sfhover\\b\"), \"\"); } } } if (window.attachEvent) window.attachEvent(\"onload\", sfHover);" . "</script>"; $pages = array( "Home" => "index.php", "Customer Login" => "survey.php", "Company Login" => "login.php", "About" => "#", "Target Industries" => "industries.php", "Register" => "#", "Contact" => "contact.php" ); $about = array( "TellBuddy" => "about.php", "INQUIZIVE?" => "#" ); $register = array( "Company" => "register_company.php", "Individual" => "register_individual.php" ); $nav .= "<ul id=\"navmenu\">"; foreach ($pages as $name => $url) { $nav .= "<li><a href=\"$url\">$name</a>"; if ($url == "#") { $nav .= "<ul>"; if ($name == "About") { foreach ($about as $n => $u) $nav .= "<li><a href=\"$u\">$n</a></li><br><br>"; } elseif ($name == "Register") { foreach ($register as $n => $u) $nav .= "<li><a href=\"$u\">$n</a></li><br><br>"; } $nav .= "</ul>"; } $nav .= "</li>"; } $nav .= "</ul> <br><br>"; return $nav; } And here is the corresponding CSS code: #navmenu, #navmenu ul { padding: 0; margin: 0; list-style: none; } #navmenu a { display: block; width: 10em; border: 1px solid #0E3B65; } #navmenu li { float: left; width: 10em; } #navmenu li ul { position: absolute; width: 10em; left: -999em; } #navmenu li:hover ul { left: auto; } #navmenu li:hover ul, #navmenu li.sfhover ul { left: auto; } Any help is GREATLY appreciated! Thanks!
  13. maybe you are calling the function with $page == 0?
  14. http://www.zend.com/zend/trick/html-email.php
  15. http://en.wikipedia.org/wiki/Crontab
×
×
  • 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.