No matter how much you worked and re-worked, risking not finishing the entire test over this whole problem, which is like #2 out of 5, you kept re-working trying to figure out where you went wrong cus you knew you that it wasn't you.
So finally you walk up to the teacher and say something. You show your work and you're like "I think there's a typo. You wrote the problem down wrong." The teacher looked at you but this isn't the first time you've questioned his or her authority. He's got this "Who you think you are..." look on his face, "Punk ass 8th grader."
So he works it out and BOOM...you were right and he was wrong. You're basking in your glory trying to hold it in from not breaking out into an MC Hammer dance and rub it in his face.
Well that's what happened as I was working through Kevin Yank's book. Peep the following code:
$result = mysqli_query($link,
'select joke.id, joketext, name, email
from joke inner join author
on authorid = author.id');
if (!$result)
{
$error = 'Error fetching jokes: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
while ($row = mysqli_fetch_array($result))
{
$jokes[] = array('id' => $row['id'], 'text' => $row['joketext'], 'name' => $joke['name'], 'email' => $joke['email']);
}
which when ran produces the following error:

I'm pretty sure what he meant to write was:
$result = mysqli_query($link,
'select joke.id, joketext, name, email
from joke inner join author
on authorid = author.id');
if (!$result)
{
$error = 'Error fetching jokes: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
while ($row = mysqli_fetch_array($result))
{
$jokes[] = array('id' => $row['id'], 'text' => $row['joketext'], 'name' => $ROW['name'], 'email' => $ROW['email']);
}
I'll spare you the details and let's just say that you "joke"d when you should have "row"d.
You might want to take care of that Kevin, and make sure I get my props.
No comments:
Post a Comment