hi forum
i was trying to fetch records from database against id but it gives error
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 1 on MySQL result index 3 in C:\xampp\htdocs\regadmin.php on line 52

<?php

$dbhandle = mysql_connect('localhost', 'root', '');

if ($dbhandle == false)
{
die ("Unable to connect to MySQL Database<br>");
}


if(!($db = mysql_select_db('registration'))){
echo "byeeeeeeeeeeeeeeeeeeeeeeeeeeee Unable to Select MySQL Database";}

$id = $_POST[id1];
//$name = $_POST[txtname];
$qr = "select * from Table2 where ser = $id";
if(!($rs=mysql_query($qr))){

echo "cant insert";

}
while(mysql_fetch_row($rs)){
$med = mysql_result($rs,1);
$reg = mysql_result($rs,2);
$enr = mysql_result($rs,3);
$proga = mysql_result($rs,4);
$nam = mysql_result($rs,5);
$hf = mysql_result($rs,6);
$dob= mysql_result($rs,7);
$nat = mysql_result($rs,8);
$gen = mysql_result($rs,9);
$cat = mysql_result($rs,10);
$tar= mysql_result($rs,11);
$mar = mysql_result($rs,12);
$rel = mysql_result($rs,13);
$mino = mysql_result($rs,14);
$status = mysql_result($rs,15);
$ph = mysql_result($rs,16);
$pht = mysql_result($rs,17);
$pho = mysql_result($rs,18);
$emp = mysql_result($rs,19);
$scha = mysql_result($rs,20);
$schd = mysql_result($rs,21);
$sfi = mysql_result($rs,22);
$qua = mysql_result($rs,23);
$ms = mysql_result($rs,24);
$pr = mysql_result($rs,25);
$div = mysql_result($rs,26);
$percent = mysql_result($rs,27);
$bord = mysql_result($rs,28);
$ad1 = mysql_result($rs,39);
$ad2 = mysql_result($rs,30);
$dist = mysql_result($rs,31);
$city = mysql_result($rs,32);
$phn = mysql_result($rs,33);
$fax = mysql_result($rs,34);
$mob = mysql_result($rs,35);
$email = mysql_result($rs,36);
$subject = mysql_result($rs,37);
$ser = mysql_result($rs,38);
}

It looks like you are trying to get the 39th column in that row, and telling it to grab the 40th. And there's only 39 columns in total.

start numbering from 0, not 1.

while(mysql_fetch_row($rs)){
$med = mysql_result($rs,0);
$reg = mysql_result($rs,1);
$enr = mysql_result($rs,2);
$proga = mysql_result($rs,3);
$nam = mysql_result($rs,4);
$hf = mysql_result($rs,5);
$dob= mysql_result($rs,6);
...

or even better use mysql_fetch_assoc instead

there are total 39 fields in db i dont want to get 1st colunm[0] .but i want to start from colunm[1]

there are total 39 fields in db i dont want to get 1st colunm[0] .but i want to start from colunm[1]

It's exactly as I had said. You are telling it to get the 40th column. There's only 39 columns. Since there's no column 40, it gives you the error. It starts counting from 0. You are trying to get column 40 by telling it to get 39 on your $ad1 line.

I think you meant 29, not 39.

$ad1 = mysql_result($rs,29);

oooooooooooooooooooh its not working i changed the indez but :(

This article has been dead for over six months. Start a new discussion instead.