Skip to content

Instantly share code, notes, and snippets.

@weatheredwatcher
Created April 13, 2011 21:48
Show Gist options
  • Save weatheredwatcher/918502 to your computer and use it in GitHub Desktop.
Save weatheredwatcher/918502 to your computer and use it in GitHub Desktop.
puts alere survey results into alere dataset
<?php
require_once('includes/db.inc.php');
$results = mysql_query('SELECT ID, Alere_PID FROM qcl.alere');
while($row = mysql_fetch_assoc($results)){
$current_pid = $row['Alere_PID'];
$pid_results = mysql_query("SELECT Question, Answer FROM qcl.alere_results WHERE PID = '$current_pid'");
while($pid_row = mysql_fetch_row($pid_results)){
$question = $pid_row[0];
$answer = $pid_row[1];
$query = "UPDATE qcl.alere SET $question = '$answer' WHERE Alere_PID = '$current_pid'";
mysql_query($query) or die(mysql_error());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment