Forum Moderators: coopster
Here is the code:
function displayAlumInfo($result) {
while ($row = mysql_fetch_array ($result))
{
$pic = $row['pic_url'];
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Picture:</td><td><img src='$pic'></td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Tell us about where you are living now:</td><td> {$row['living']}</td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Are you married (Spouse name, Years married)?:</td><td> {$row['spouse']}</td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Kids (Names, Ages)?:</td><td> {$row['kids']}</td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>What are you doing (Jobs, Hobbies, Pastimes)?:</td><td> {$row['job']}</td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Anything else we should know about your life now?:</td><td> {$row['life']}</td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Best MHS memory:</td><td> {$row['bestMHS']}</td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Worst MHS memory:</td><td> {$row['worstMHS']}</td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Most embarrassing MHS memory:</td><td> {$row['embarrassMHS']}</td></tr>";
print "\n<tr>\n\t<td width='25%' bgcolor='#BCD2EE'>Message to fellow MHS Alumni:</td><td> {$row['message']}</td></tr>";
}
}
$result = mysql_query("SELECT * FROM alumInfo WHERE userId = '$alumni'");
displayAlumInfo($result);
I've tried adding
$result = stripslashes($result);
and changing the function to
function displayAlumInfo(stripslashes($result))
but I get errors with the while loop.
Any ideas?
you need to do it on every array value
stripslashes($row['living']);
etc
by the way, you shouldn't use stripslashes for inserting into mysql, you should use mysql_real_escape_string [php.net]