Jump to content
Larry Ullman's Book Forums

Recommended Posts

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');

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...