Any ideas on how to incorporate a simple database into my website?

Firstly I am to create a website that will survey the user on what their ideal laptop would be (each answer would relate to a certain brand or model of laptop); once the user has filled out the survey I went to be able to tally up their results to work out which record in the pre-existing database would be best suited...
This would be a simplified example,
Which brand would you prefer:
Apple  ( )        HP      ( )         Sony    ( )
Price range:
100   ( )       200    ( )     300     ( )
I have attempted to just 'search the database' since each answer has is representing a record in the database; however this does not take into account various answers across the survey (Will only search and display for the price, while ignoring what brand, etc.)
The database is on phpmyadmin, whether that makes any difference.
Perhaps there is a simple line of code that will handle all this, but I'm relatively new to the whole thing so any help would be greatly appreciated.

Having a bit of trouble getting it to work, would you mind looking over my code to see where I've messed up?
<?php require_once('../Connections/survey.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  return $theValue;
$colname_Brand = "-1";
if (isset($_GET['Brand'])) {
  $colname_Brand = $_GET['Brand'];
mysql_select_db($database_survey, $survey);
$query_Brand = sprintf("SELECT * FROM ideal WHERE Brand = %s", GetSQLValueString($colname_Brand, "text"));
$Brand = mysql_query($query_Brand, $survey) or die(mysql_error());
$row_Brand = mysql_fetch_assoc($Brand);
$totalRows_Brand = mysql_num_rows($Brand);
$colname_Price = "-1";
if (isset($_GET['Price'])) {
  $colname_Price = $_GET['Price'];
mysql_select_db($database_survey, $survey);
$query_Price = sprintf("SELECT * FROM ideal WHERE Price = %s", GetSQLValueString($colname_Price, "text"));
$Price = mysql_query($query_Price, $survey) or die(mysql_error());
$row_Price = mysql_fetch_assoc($Price);
$totalRows_Price = mysql_num_rows($Price);
$colname_Rating= "-1";
if (isset($_GET['Rating'])) {
  $colname_Rating = $_GET['Rating'];
mysql_select_db($database_survey, $survey);
$query_Rating = sprintf("SELECT * FROM ideal WHERE Rating = %s", GetSQLValueString($colname_Rating, "text"));
$Rating = mysql_query($query_Rating, $survey) or die(mysql_error());
$row_Rating = mysql_fetch_assoc($Rating);
$totalRows_Rating = mysql_num_rows($Rating);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search Results</title>
</head>
<body>
<h1> Survey results</h1>
<?php
    $temp = $totalRows_Results;
    if ($temp == 0) { echo "No Records Found"; }
?>
<table width="200" border="1">
  <tr>
    <td>id</td>
    <td>Brand</td>
    <td>Name</td>
    <td>Price</td>
    <td>Rating</td>
    <td>Purpose</td>
  </tr>
  <?php do { ?>
  <tr>
    <td><?php echo $row_Results['id']; ?></td>
    <td><?php echo $row_Results['Brand']; ?></td>
    <td><?php echo $row_Results['Name']; ?></td>
    <td><?php echo $row_Results['Price']; ?></td>
    <td><?php echo $row_Results['Rating']; ?></td>
    <td><?php echo $row_Results['Purpose']; ?></td>
  </tr>
  <?php } while ($row_Results = mysql_fetch_assoc($totalRowResults)); ?>
</table>
<br />
<a href="survey.html">Back to survey</a>
</body>
</html>
<?php
mysql_free_result($Results);
?>

Similar Messages

  • Any ideas on how to make program simpler?

    This program is designed to send multiple TTL pulses to different instruments, while at the same time receiving and analyzing analog input data.  We will likely be sampling at fairly low rates (rarely over 100 Hz).  We will be getting a new USB board soon, but this program is written for the USB-6008.  The program is over 9 MB, and I would like to know if there is anything I can do to make it more manageable.  I have already gotten a lot of help from this forum and really appreciate it (haven't done much computer programming before this summer) and those of you in cyberspace have saved me a lot of headaches.  Thanks in advance for the help!
    Attachments:
    Linear 3ch Wave Gage and pressure Data Capture.zip ‏162 KB

    Hello again
    Thanks lynn for the advice, I am sorry for the delay since my last post.
    I am pretty comftorable with the programming of labview, but not the applications of DAQmx and data flow overall for that matter.  I have been searching the forums all morning trying to find some examples of what I wish to do, but have been unsuccessful.  What I am working on is creating a program that controls all of the instruments in the lab, in other words, send triggers to different instruments at different times to turn them on and off. 
    I now see that the wait VI that I put in the TTL subVI was a poor choice and am still trying to find a way around it. 
    I want to set up some kind of a clock that starts when the VI is run.  From this, I want to allow the user to set up a delay for each TTL, so the wavemaker might be triggered immediatly, but the individual instruments could be triggered after some time interval.  The On/Off booleans are present because we do not use all the instruments at all times, so if say the laser is off, LabView would not send the TTL to laser's computer.  I would also like to incorporate the data acquisition to the clock, say to let the wavemaker run for 5 minutes before data is acquired, however that part won't be too hard once I figure the timing out. 
    An example of what might need to be done could be
    1.  VI is started
    2.  Wavemaker is triggered immediatly
    3.  Data acquisition is started after 5 minutes, and acquires 10,000 samples at 100 Hz
    4.  Laser and ADV are triggered simultaneously after 6 minutes
    5.  After voltages are acquired, they data are analyzed (plugged into a calibration curve to get pressure or wave height...)
    6.  The final values are written to a spreadsheet.
    I am thinking that using a tick counter and event structures might work, but I havent been able to figure it out yet.
    Thanks
    Chris

  • Today all my Bookmarks disapeared from Safari, when i checked my iphone they were there and then went away the same happened on my ipad. Any ideas on how to restore?

    Today all my BookMarks disappeared in Safari, when I checked my iphone I watched them disappear from there and the same on my iPad. I then thought why not check my Parallels side and Windows Explorer. They were there for a few seconds and then also gone. Any ideas on how to restore and stop this from happening again? My iCloud setting are set for Safari sync.

    Then you have misunderstood what iCloud is.
    First. It is not a back-up service. It is a sync service.
    That distinction is very import. A back-up service would have backed-up your bookmarks but iCloud's function is to synchronize your data, in this case your bookmarks, to all your devices. A backup service, by it's very nature, would allow you to roll back to a previous version of your data or file. No such roll back function is present in iCloud's services.
    For example, if you add a bookmark to Safari on your Mac that same bookmark will be added to all your other devices that are connected to your iCloud account. Also, if you delete a bookmark it will be deleted from all those devices.
    iCloud does not make a distinction between deleting one or all of your bookmarks and it will do the same to all your devices. It does not know that was not your intention. That is why it is very important to have Backups and Apple makes it very easy using Time Machine and a simple hard drive connected to a computer.
    Let's see if your bookmarks have actually been deleted or if there is another problem.
    Your bookmarks are stored in a .plist file the following directory, ~/library/Safari/Bookmarks.plist
    To get to that directory go to the Finder, select the Go to Folder… menu item in the Go menu and enter ~/library/Safari/ in the field provided. There you will find the Bookmarks.plist file.
    Select it and hit the space bar on your keyboard to see a preview of the files content. Does it still contain references to your bookmarks? If it does still contain references to your bookmarks then something else is going on and we'll have to find a different solution.

  • I cannot get a dvd to play. The error message says "media type not supported". I think it is a .m2ts. Any idea on how I can get it to play?

    I cannot get a dvd to play on my computer. The error message says in iDVD is "media type not supported".
    The DVD was produced with a video camera and is in HD format. I think the the format is .m2ts?
    Any ideas on how to get this to play?

    Check out > Mac App Store - Free MTS M2TS Converter
    and/or others at > playing .m2ts format in OS X - Google Search

  • I have purchased itunes match but the cloud will not load on my ipad 4.the only music that will show up is stuff that i bought from the itunes store.any ideas on how to get this to work?

    i have purchased itunes match but the cloud will not load on my ipad 4.it works on my iphone 5 & it originally worked on my ipad.the only music that will show up is stuff that i bought from the itunes store.any ideas on how to get this to work?

    On the MBP, in iTunes, switch to Song view and enable the iCloud Status column by pulling down View > View options and selecting the option for "iCloud Status." Close the small window. Look for any tracks that have a status of "waiting." If you see several of them disable iTunes Match while holding down the Option key. Quit iTunes, wait a few seconds, then open it again and turn iTM back on. Let it compelete the scan. Wait until all tracks that are "waiting" have a status of either "matched" or "uploaded."
    On the iPad, turn off iTunes Match then launch the Music app and let the contents clear out. Power cycle the iPad for good measure, then re-enable the service once all the tracks in iTunes have been processed.

  • Duplicates of a song on iPhone 4s but not in iTunes. Unable to delete duplicate. Won't play and won't let you swipe to delete. Any ideas on how to do so without resetting the phone?

    I have duplicates of a song on an album. One of the duplicates is grey with no album cover. When you attempt to swite and delete, the track will not delete and will not even play. I've contacted iTunes store and the person I received the support email from told me that it may not be downloaded. I emailed him back and explained that no there is no download for that song in my itunes store on my phone.
    One I never received an answer back which shows you how well these people do their job.
    Two: I really would prefer to have a solution to this problem without having to delete all of my music from my phone or resetting my phone. Because this duplicate isn't even showing up in my iTunes, it's only showing up on my phone.
    When I attempt to find it in my itunes it plays fine. But when I try to find the file to delete it, it is no where to be found. I've tried everything that I could think of to get rid of it. And I don't want to leave the album/artist off my phone because I do enjoy their music... And I have the microsoft sync in my car.
    Anyone got any ideas on how to do this without resetting the phone and/or taking my music off?

    If you have all your music on the cmputer then i would connect up my phone uncheck the Sync Music option and apply.
    This should take all the music off your phone .Then you can resync the music back on to it.
    If this doesn't work maybe a restore to factory settings and start from scratch is the way to go

  • My Iphone 5 won't show up in itunes on my computer? Any idea on how to fix this problem?

    My Iphone 5 won't show up in itunes when i plug it into my windows 8 laptop but it shows up on my computer under devices and drivers as an iphone. Any idea on how to fix this problem so I can use my phone in itunes?

    http://support.apple.com/kb/ts1538

  • I'm trying to connect my 30" Cinema Display to my new Mac Pro along with a new Apple 23'" monitor.  The new Apple monitor is fine.  On the cinema monitor everything is blown up pretty large.  Any ideas on how to solve this?

    I'm trying to connect my 30" Cinema Display to my new Mac Pro along with a new Apple 23'" monitor.  The new Apple monitor is fine.  On the cinema monitor everything is blown up pretty large.  Any ideas on how to solve this?

    The 30" display needs a DUAL-LINK adapter.
    <http://store.apple.com/us/product/MB571Z/A/mini-displayport-to-dual-link-dvi-ada pter>

  • After connecting my Apple TV this morning, I have no sound. It is hooked up to play through my television speakers. Any ideas on how to get sound? Also, I tried hooking it up through my surround receiver, but could not get it to come up on my ty screen.

    After connecting my Apple TV this morning, I have no sound. It is hooked up to play through my television speakers. Any ideas on how to get sound? Also, I tried hooking it up through my surround receiver, but could not get it to come up on my ty screen, what can I do to correct this problem?

    Have you tried adjusting the "Audio Out" and the "Dolby Digital" settings in settings > audio and video? It may be worth trying several combinations of these settings, although typically it is the "Dolby Digital" setting that causes most problems for users.
    Also make sure that you have correctly mapped the input port on your sound system to the output, if you are unsure about how to do this, refer to the manual that came with your sound system.
    Have you tried playing various content sources (i.e. podcasts, music, iTunes Store video, other video etc), do you have the same problem with all types of content? If you use optical you might also check that you can see a red light at the end of your optical audio cable. Is your optical audio cable plugged straight into your sound system, or does it go through a switch or other device?

  • I am trying to play a DVD on my MacBook Pro and transmit it to my TV (use my TV as the monitor) utilizing a VGA cable and adapter for the Mac but the only image that shows up on the TV is the MacBook wall paper, any ideas on how I can transmit to my TV?

    I am trying to play a DVD on my MacBook Pro and transmit it to my TV (using my TV as the monitor) utilizing a VGA cable and adapter for the Mac but the only image that shows up on the TV is the MacBook wall paper, any ideas on how I can transmit the movie from my MacBook to the TV?  I also tried an HDMI cable and had the same issue.

    you are probably seeing the extended display.. to see ur main display go to pefrences then display steeings and turn mirroring on.
    this will display ur mbp main screen. good luck.

  • When I switch my time capsule to 5.0ghz mode the range of my wireless network drops significantly.  Near the Time Capsule my Macbook Pro works fine, in my bedroom I have almost no signal.  In mixed mode it works fine.  Any ideas on how to get 5.0 working?

    When I switch my time capsule to 5.0ghz mode the range of my wireless network drops significantly.  Near the Time Capsule my Macbook Pro works fine, in my bedroom I have almost no signal.  In mixed mode it works fine both placed.  Any ideas on how to get 5.0 working?  I thought 5.0Ghz was supposed to have a wider range.  Do I need to change a setting on the Macbook Pro?
    Thanks, W

    I'm not sure if you understand that 5 GHz has some upsides, but also some very significant downsides.
    The upside is that the 5 GHz signal will allow faster speeds.
    The downside is that you must always give up something in order to gain something else.Unfortunately, the marketing hype about 5 GHz does not go into very many details about this.
    In the case of 5 GHz, the 5 GHz signals are much weaker than 2.4 GHz signals, so they do not travel as far or penetrate any obstructions like walls or ceilings nearly as well as 2.4 GHz signals. In many cases, in order to get good 5 Ghz performance, you literally have to have almost a line-of-sight relationship between your computer and the wireless router.
    If you have a new dual band router, which broadcasts both a 2.4 GHz and 5 GHz signal simutaneously, your Mac will connect to the best signal quality automatically depending on its location in relation to the router. In the same room, without any obstructions, it will connec to 5 GHz. But, take the laptop down the hall a few rooms and around the corner and the Mac will connect to the 2.4 GHz signal because at that location, the 2.4 GHz signal is not only stronger, it is also faster.

  • I have a new Mac Mini and I found AdWare called TakeOverSearchAssetsMac and SearchProjects on it. I have been unable to remove it. Does anyone have any ideas on how to remedy this?

    I have a new Mac Mini and I found AdWare called TakeOverSearchAssetsMac and SearchProjects on it. I have been unable to remove it. Does anyone have any ideas on how to remedy this?

    Please review the options below to determine which method is best to remove the Adware installed on your computer.
    The Easy, safe, effective method:
    http://www.adwaremedic.com/index.php
    If you are comfortable doing manual file removals use the somewhat more difficult method:
    http://support.apple.com/en-us/HT203987
    Also read the articles below to be more prepared for the next time there is an issue on your computer.
    https://discussions.apple.com/docs/DOC-7471
    https://discussions.apple.com/docs/DOC-8071

  • I am trying to record a from my Macbook Air and an annoying loud sound, like a burp, will suddenly erupt from the MacBook, necessitating I start again. Any ideas on how I may stop this, or what it is??

    I am trying to record a meditation from my Macbook Air and an annoying loud sound, like a burp, will suddenly erupt from the MacBook, necessitating I start again. Any ideas on how I may stop this, or what it is??

    Click on the blue Internet Recovery in nbar's post. That is a link to what computers can run Internet Recovery.
    Do a backup,  preferable 2 separate ones on 2 drives. Boot to the Recovery Volume (command - R on a restart or hold down the option/alt key during a restart and select Recovery Volume). Run Disk Utility Verify/Repair and Repair Permissions until you get no errors.  Reformat the drive using Disk Utility/Erase Mac OS Extended (Journaled), then click the Option button and select GUID. Then re-install the OS.
    OS X Recovery
    OS X Recovery (2)
    When you reboot, use Setup Assistant to restore your data.

  • I am trying to open PDF files from safari, but when I click on them they open in a separate window and the information is encrypted. Any ideas on how to get them to open them in Adobe? Any help please!

    I am trying to open PDF files from safari, but when I click on them they open in a separate window and the information is encrypted. Any ideas on how to get them to open them in Adobe? Any help please!

    The pdf is loading as html code. If you save it, it will download as :
    605124.pdf.html
    Change the extension to .pdf
    And it opens and works perfectly, I just tested it:
    Use this link to download it automatically:
    http://saladeaula.estacio.br/arquivo.asp?dir=00/1020624/605124.pdf&num_seq=59828 4

  • I am trying to save a doc. to a external hard drive and it wont allow me. I says its read only, any ideas on how to correct it?

    I am trying to save a doc. to a external hard drive and it wont allow me. I says its read only, any ideas on how to correct it?

    Save it on the internal HD then copy it from this safe location to the external device.
    iWork applications can't apply their save process on devices which aren't formatted as HFS+.
    But it may also be that for some reason, an external device formatted as HFS+ is set to Read Only.
    If it's this case, you will have to change de setting before moving the file on it.
    Yvan KOENIG (VALLAURIS, France) vendredi 20 mai 2011 11:01:05
    Please :
    Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Maybe you are looking for