PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
SELECT * FROM `Users`.`members` WHERE `member_id` = 5
Resource id #4
I have no idea what I'm doing wrong because I have this code in another php script file and it works fine (although I'm using a different table).
As always, thanks for the help.
Hey Greg,
I'm trying to INSERT a filename in a field called pers_img in a table called members but the php code fails at this point. The query result is Resource id #4 which I'm sure you could see. Maybe more of the code will help.
$db = mysql_select_db('Users')
or die('Unable to select database');
$SQL = 'SELECT * FROM `members` WHERE `member_id` = '.(int)$_SESSION['SESS_MEMBER_ID'];
$rsMember = mysql_query($SQL)
or die('Invalid Query: '.mysql_error()."\nQeury: ".$SQL); // Leave in only for debugging
if ($rsMember && mysql_num_rows($rsMember)>0) {
$aryMember = mysql_fetch_assoc($rsMember);
mysql_free_result($rsMember);
$SQL = 'INSERT INTO `members` (`pers_img`) VALUES ("'.mysql_real_escape_string($pers_img_up).'")';
mysql_query($SQL)
or die('Invalid Query: '.mysql_error()."\nQeury: ".$SQL); // Leave in only for debugging
session_write_close();
}
else {
// There were no results for the first query
echo "FAIL!";
}
// As both paths of the if statement would ended in an exit,
// This should be the end of the file, so need to expicitly call it