...

View Full Version : Notice: Undefined index: prop_id in



zoni
05-29-2004, 10:26 AM
i write this php code

//*************************************************
<?php
require_once("Connections/connection.php");
$q_prod_prop = "select * from prop_prod";
$rs_q_prop_prod = mysql_query($q_prod_prop,$link) or die(mysql_error($link));

echo "Query :" .$q_prod_prop;
echo "<br>";
echo "<br>";
echo "Total No. of Records :".mysql_num_rows($rs_q_prop_prod);
echo "<BR>";
while($rows_rs_q_prop_prod = mysql_fetch_row($rs_q_prop_prod))
{
echo $rows_rs_q_prop_prod["prop_id"];
echo $rows_rs_q_prop_prod["prop_value"];
}
?>
//************************************************** *

But output of above php code is
//**************************************************

Query :select * from prop_prod

Total No. of Records :100

Notice: Undefined index: prop_id in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 13

Notice: Undefined index: prop_value in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 14

Notice: Undefined index: prop_id in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 13

Notice: Undefined index: prop_value in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 14

Notice: Undefined index: prop_id in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 13

Notice: Undefined index: prop_value in c:\inetpub\wwwroot\sdsdynamic\testing.php on line 14

so on....
//************************************************** ****

why it gives me Notice: Undefined index: prop_value in...
Plz help me thanx.... in adv..

missing-score
05-29-2004, 11:28 AM
When you use mysql_fetch_row(), a numerical index is returned, to achieve what you want you should use mysql_fetch_assoc().

ReadMe.txt
05-29-2004, 10:40 PM
or kill two birds with one stone and use mysql_fetch_Array() which will return both a numberic and associative array at negligible extra parsing to the aforementioned functions

missing-score
05-29-2004, 10:43 PM
have to disagree there, only use mysql_fetch_array() if you NEED both array types, as it is slower than mysql_fetch_assoc().



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum