21288 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1122 Views |
-
SS mySQL query halp

6 October 2010 at 10:13am
So i'm a bit of a newbie having trouble with this sql query. I have a form in the cms that allows a user to input a vimeo video ID and then pass that to the vimeo moogaloop api.
So i've written a query the writes some xml to the head of the current videopage
$query = (int)DB::query("SELECT VimeoID FROM `VideoPage`WHERE `ID` = '$this->ID'")->value();
for some reason it keeps returning the value as 0. Any thoughts are appreciated.
peace,
dan.$result = mysql_query($query);
$doc = new DomDocument('1.0');// create root node
$root = $doc->createElement('vimeoURL');
$root = $doc->appendChild($root);
// add node for each row
$occ = $doc->createElement('vimeoURL');
$occ = $root->appendChild($occ);
$child = $doc->createElement('URL');
$child = $occ->appendChild($child);
$value = $doc->createTextNode('URL' + $result);
$value = $child->appendChild($value);
$xml_string = $doc->saveXML();
//header('Content-Type: application/xml; charset=ISO-8859-1');
echo $xml_string; -
Re: SS mySQL query halp

6 October 2010 at 11:26am
hi dan, is there a reason not to use DataObject::get_by_id?
e.g.$doVideoPage = DataObject::get_by_id('VideoPage',$this->ID);
...
$occ = $doc->createElement($doVideoPage->vimeoURL); //assuming vimeoURL is in $db of $doVideoPage)
... -
Re: SS mySQL query halp

6 October 2010 at 3:02pm
If you really want to use SQLQuery, I think it would look more like this
$query = new SQLQuery();
$query->select = array("VimeoID");
$query->from = array("VideoPage");
$query->where = array("ID = $this->ID");$result = $query->execute()->value();
| 1122 Views | ||
|
Page:
1
|
Go to Top |



