ray Posted May 25, 2007 Report Share Posted May 25, 2007 (edited) Ir šāda lieta ar sql vaicājumu $aa = 'SELECT * FROM tabula WHERE id = 1'; $bb = mysql_query($aa) or die (mysql_error()); if (mysql_num_rows($bb) == 1) { echo 'Paziņojums'; } Man vajadzētu kaut ko tādu arī ar Delete. Mēģināju tāpat kā ar SELECT, bet nesanāca $aa = 'DELETE FROM tabula WHERE id = 1'; $bb = mysql_query($aa) or die (mysql_error()); if (mysql_num_rows($bb) == 1) { echo 'Paziņojums'; } Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in Cerams, ka sapratāt manu domu. Paldies! Edited May 25, 2007 by ray Link to comment Share on other sites More sharing options...
v3rb0 Posted May 25, 2007 Report Share Posted May 25, 2007 Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use mysql_affected_rows(). http://lv.php.net/mysql_num_rows Link to comment Share on other sites More sharing options...
andrisp Posted May 25, 2007 Report Share Posted May 25, 2007 Īsti nesapratu gan. Tev vajag apstiprinājumu, ka ieraksts ir izdzēsts ? Ja jā, tad: if (mysql_query($sql)) { echo 'Dzeests!'; } Ja tev vajag noskaidrot vai izdzēsta tieši viena rindiņa, tad php.net/mysql_affected_rows() Link to comment Share on other sites More sharing options...
ray Posted May 25, 2007 Author Report Share Posted May 25, 2007 būtībā man vajadzēja vai ieraksts ir dzēsts. Paldies, problēma atrisināta ;) Link to comment Share on other sites More sharing options...
Recommended Posts