Get a single result

From: Date: Wed, 02 Oct 2002 16:57:38 +0000
Subject: Get a single result
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-22168@lists.php.net to get a copy of this message
Hello guys. The scenery: I've got an array with some values stored in it. I want to retrieve the id code each value is associated to. So I just do the following: for ($i=0; $i<count($form_category);$i++) { $query_get_id = "select cat_code from categories where cat_name like '$form_category[$i]'"; $result_category_id = mysql_query($query_get_id) or die(mysql_error()); $form_category_id[$i] = mysql_result($result_category_id, 0, $i); //This is line 170 echo $form_category[$i]." ".$form_category_id[$i]."<br>"; } I'm getting the following in my browser (There are some comments I just added): Arquitectura 2 //This is the correct category name and its ID Warning: Bad column offset specified in /var/www/bva/new/common/scripts/admin_functions.php on line 170 Caricatura //This is the correct category name but the ID is lost Warning: Bad column offset specified in /var/www/bva/new/common/scripts/admin_functions.php on line 170 Ciencias naturales //Same as before Any idea of what I'm doing wrong? ******************************************************* Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *******************************************************

« previous php.db (#22168) next »