I’m a new comer to Linux/Ubuntu so if I make any silly mistake please forgive me.
My code works fine in XP but not in Ubuntu 11.04 (Same PHP/MySQL version)
<?php
if (!isset($_SESSION['uid'])) {
header('Location:index.php');
exit;
} else {
if (file_exists("profile_pic/".$_SESSION['uid'].".jpg")) {
echo '<a href="'.$SitePath.'profile.php?id='.$_SESSION['uid'].'"><img src="'.$SitePath.'profile_pic/'.$_SESSION['uid'].'.jpg" alt="'.$_SESSION['name'].'" title="Me" border="0"/></a>';
} else {
echo '<a href="'.$SitePath.'profile.php?id='.$_SESSION['uid'].'"><img src="'.$SitePath.'profile_pic/nopic.jpg" alt="'.$_SESSION['name'].'" title="Me" border="0" /></a>';
}
?>
If a file exists with name of $_SESSION['uid'].".jpg" then show it, else show an default image.
The error I’m getting
Catchable fatal error: Object of class mysqli_stmt could not be converted to string
You’re not showing any database operations, but most likely you’ve got something like:
wherever you’re initializing your session data. This is incorrect. The query functions return a statement handle, from which you can fetch the data. In pseudo-code, it’d be: