| jasonc 2006-06-01, 7:50 am |
| i am getting the error
Warning: mysql_result(): Unable to jump to row 0 on mysql result index 7
please can smoeone tell me where i might be going wrong?
thanks
<?
include("dbconfig.php");
//get reg code
$findstring = trim($_GET[s]);
if ($findstring != "") {
//find reg code in memberslist
$res = mysql_query("SELECT code FROM users WHERE code='$findstring' LIMIT 1");
if (mysql_num_rows($res) == 1) {
$res = mysql_query("UPDATE users SET code = 'done', password = 'catanddog' WHERE code='$findstring' LIMIT 1");
//upto here all is ok.
$res = mysql_query( "SELECT email FROM users WHERE code='$findstring' LIMIT 1" ) or die ( mysql_error() );
// the line above is almost the same as the request near the top of this code, eccept that it now looks for the email field not the code field.
$email = mysql_result( $res, 0 ) or die( mysql_error() );
echo('a.'.$email.'.a');
$res = mysql_query("INSERT INTO anothertable (email, field1, field2) VALUES ('$email', '', '')");
?>
<p>Thank you for completing you registration process.</p>
<?
} else {
?>
<p>Sorry but this is an illegal action.</p>
<?
}
}
mysql_close;
?>
and this is my database entry.
CREATE TABLE `users` (
`code` varchar(32) NOT NULL default '',
`email` varchar(40) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` VALUES ('123', 'someone@domain.com'); |