How to delete a node with PHP?

Tuesday, 8 March 2011 · 3 messages
YM
Yoann Maingon8 Mar 2011 00:46 #
Hi, I've started using BaseX as a database for a PHP project. I can open the database and add nodes but I can't delete nodes. I've tested the XQUERY on the GUI and it works just fine. Any clue? Here is the xquery: Here is the php code: [.]
$session->execute("OPEN data");

$session->execute("XQUERY delete nodes (//definition/item[@type='test'])");
I've tried without "XQUERY" but gives the same result. Would be nice to have a working example of such use. Best Regards, Yoann Maingon --------------------------------------- Yoann Maingon Prodeos +33 6.64.32.49.66
 <mailto:yoann.maingon at prodeos.com> yoann.maingon at prodeos.com
LOGO_14032009_OnWhite_Signature www.prodeos.com
CG
Christian Grün8 Mar 2011 00:50 #
Dear Yoann Maingon, your code snippet looks fine to me. I would assume that a third command won't return any results, as they should have been deleted from your database: print $session->execute(“XQUERY //definition/item[@type=’test’]”); If that's not the case, or if I didn't answer your question, feel free to give us more details on your problem. Christian
Quoted text · Yoann Maingon · 28 lines
On Tue, Mar 8, 2011 at 12:46 AM, Yoann Maingon <yoann.maingon at prodeos.com> wrote: > > Hi, > > I’ve started using BaseX as a database for a PHP project. I can open the database and add nodes but I can’t delete nodes. > I’ve tested the XQUERY on the GUI and it works just fine. Any clue? > > Here is the xquery: > > Here is the php code: > […] > $session->execute(“OPEN data”); > $session->execute(“XQUERY delete nodes (//definition/item[@type=’test’])”); > > I’ve tried without “XQUERY” but gives the same result. > > Would be nice to have a working example of such use. > > Best Regards, > Yoann Maingon > > --------------------------------------- > Yoann Maingon > Prodeos > +33 6.64.32.49.66 > yoann.maingon at prodeos.com > www.prodeos.com
YM
Yoann Maingon8 Mar 2011 01:04 #
Hi Christian, Thanks for confirming the syntax. It made me look closer on other possible issues and I realized I wasn't calling the right PHP file in my httprequest. It has been years without doing PHP, I've lost some reflex. Best regards, --------------------------------------- Yoann Maingon Prodeos +33 6.64.32.49.66 yoann.maingon at prodeos.com www.prodeos.com -----Message d'origine-----
Quoted text · Christian Grün · 43 lines
De : Christian Grün [mailto:christian.gruen at gmail.com] Envoyé : mardi 8 mars 2011 00:51 À : Yoann Maingon Cc : basex-talk at mailman.uni-konstanz.de Objet : Re: [basex-talk] How to delete a node with PHP? Dear Yoann Maingon, your code snippet looks fine to me. I would assume that a third command won't return any results, as they should have been deleted from your database: print $session->execute(XQUERY //definition/item[@type=test]); If that's not the case, or if I didn't answer your question, feel free to give us more details on your problem. Christian On Tue, Mar 8, 2011 at 12:46 AM, Yoann Maingon <yoann.maingon at prodeos.com> wrote: > > Hi, > > Ive started using BaseX as a database for a PHP project. I can open the database and add nodes but I cant delete nodes. > Ive tested the XQUERY on the GUI and it works just fine. Any clue? > > Here is the xquery: > > Here is the php code: > [] > $session->execute(OPEN data); > $session->execute(XQUERY delete nodes (//definition/item[@type=test])); > > Ive tried without XQUERY but gives the same result. > > Would be nice to have a working example of such use. > > Best Regards, > Yoann Maingon > > --------------------------------------- > Yoann Maingon > Prodeos > +33 6.64.32.49.66 > yoann.maingon at prodeos.com > www.prodeos.com

⚡Generated with XQuery