[ prginfo @ 04.06.2009. 13:31 ] @
Imam sledeci problem. Napravio sam formu sa padajucom listom u kojoj su nazivi a, b, c i vrednosti tih naziva a=10 b=20 c=30 Forma ima Action stranica.php U MySQL bazi koja se zove test imam napravljenu tabelu proba. Tabela ima polja id i sum. Podaci su: id 1 sum 100 id 2 sum 200 id 3 sum 300 FormMethod je POST, a dugme na formi je Submit button. Stranica.php ima sledeci kod: Code: <?php $vrednost = $_POST['vrednost']; //konektuj se na bazu $conn = mysql_connect("localhost", "", ""); mysql_select_db("test", $conn); //napravi upit $sql = "SELECT sum FROM proba where id=$vrednost"; $result = mysql_query($sql, $conn); print $result; print "<table border = 1>\n"; //get field names print "<tr>\n"; while ($field = mysql_fetch_field($result)){ print " <th>$field->name</th>\n"; } // end while print "</tr>\n\n"; //get row data as an associative array while ($row = mysql_fetch_assoc($result)){ print "<tr>\n"; //look at each field foreach ($row as $col=>$val){ print " <td>$val</td>\n"; } // end foreach print "</tr>\n\n"; }// end while print "</table>\n"; ?> Problem je sledeci: print $result; mi vraca samo Resource id #3, a deo gde je print "<table border = 1>\n"; pa nadalje mi vraca normalnu vrednost u tabeli. Da li neko zna sta je u pitanju? Unapred se zahvaljujem. [Ovu poruku je menjao flylord dana 02.07.2009. u 20:51 GMT+1] |