abigail Posted July 11, 2015 Share Posted July 11, 2015 Never mind. I figured it out. The parameters are overwritten by the Select. Can you see what is wrong with this Select. I know the variables are set and I know there is no data, the $islocked and $addr are both blank. I only fetch address to see if I can get any data. I did this from phpmyadmin and it retrieved locked=1 function failed($dbc, $em, $ad, $TheTable) { $islock=0; $addr=""; $stmt = mysqli_prepare($dbc, 'SELECT locked, address FROM $TheTable WHERE (email=? OR address=?) LIMIT 1'); mysqli_stmt_bind_param($stmt, "ss", $em, $ad); mysqli_stmt_execute($stmt) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); mysqli_stmt_bind_result($stmt, $islocked, $addr); mysqli_stmt_fetch($stmt); if ($islocked > 0) { mysqli_stmt_close($stmt); return (true); } mysqli_stmt_close($stmt); return (false); } // End of function. And this is the table CREATE TABLE IF NOT EXISTS `B_Distributors` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT 'db increments', `email` varchar(80) COLLATE utf8_unicode_ci NOT NULL, `address` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL, `locked` tinyint(1) unsigned DEFAULT NULL COMMENT 'I forbid', `notes` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `orig_date` datetime DEFAULT NULL, `time_stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; -- -- Dumping data for table `B_Distributors` -- INSERT INTO `B_Distributors` (`id`, `email`, `address`, `locked`, `notes`, `orig_date`, `time_stamp`) VALUES (1, 'bca@rr.com', '71st Street', 1, '', '2015-07-11 11:43:41', '2015-07-11 15:43:41'); Link to comment Share on other sites More sharing options...
Larry Posted July 13, 2015 Share Posted July 13, 2015 Ah, excellent. Glad you figured it out and thanks for letting us know! Link to comment Share on other sites More sharing options...
Recommended Posts