My goal is to get the relevant rows from the database using getideas.php, so then on displayideas.php, I can actually pick them apart (e.g. get the idea with the highest score, display the idea score, display the idea in a particular html part of the code within a span).
On getideas.php, I have the following:
$sql = "SELECT evals.idea_score, evals.ideas_idea_id, ideas.idea
FROM evals, ideas
WHERE evals.ideas_idea_id = ideas.idea_id
AND evals.users_eval_id = '$eval_id'";
$result = mysql_query($sql);
$data = array();
while($row = mysql_fetch_assoc($result)){
$data[] = $row["idea_score"];
array_push($data, $row["ideas_idea_id"], $row["idea"]);
}
return $data;
On displayideas.php, I have the following:
$.ajax({type: "POST",
url: "getideas.php",
data: { eval_id: eval_id },
success: function(response){
console.log(response);
}
})
I am not sure if I necessarily need an array. I am new to PHP/MySQL. I have been searching an answer to this online but cannot find a place that just puts it all together in a way I can understand to solve my problem. At this point, I feel like I have spent way too much time on it, and it is time to ask for help!