1
jmass
Getting late or rusty - SQL question
  • 2004/3/26 3:57

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


It is either getting late or I havn't worked with XOOPS in a month or so. (I was never that good to begin with)

I need to delete a record from a SQL table. I have a class set up and want to add a method:

function deleteClientID($CurrentID)
{
global $xoopsDB;
$query_table = $xoopsDB->prefix('obsclient_clients');
$sql = "DELETE FROM $query_table WHERE ClientID = $CurrentID";
$result = $xoopsDB->queryF($sql);
$ret = $result
return $ret;
}

This is what I have. Will this work? Are the last two line needed? is queryF the right or wrong choice here and why? If some one could walk me through the code step by step and correct it if possible that would be great. I know that it is super simple, but I am unclear.

Any insight would be appreciated.

JMass

2
Dave_L
Re: Getting late or rusty - SQL question
  • 2004/3/26 4:17

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


$xoopsDB->query() should normally be used instead of $xoopsDB->queryF(). The latter (queryF) should only be used if the script performing the query is executing as a result of a GET request, and you want to override the safety check done by $xoopsDB->query().

I would change the last three lines from

$result $xoopsDB->queryF($sql);
$ret $result
return $ret


to

return $xoopsDB->query($sql);


The function's return value will be TRUE if the query was successful, and FALSE otherwise.

3
jmass
Re: Getting late or rusty - SQL question
  • 2004/3/26 4:49

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


Thanks!

I will have to go though my class files and replace queryf with query for most.

I thought that the last lines seemed redundant for no reason.

Thanks again,

JMass

Login

Who's Online

886 user(s) are online (58 user(s) are browsing Support Forums)


Members: 0


Guests: 886


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits