Load pod item

0

Hi. I'm stuck with load_ pod_ Item function. I use the following code:

<?php $api = new PodAPI();
$whargarbl = $api->load_pod_item(9,1); // i've also tried putting valid Pod name instead of datatype id, the error code is just the same
print_r($whargarbl);?>

the result is SQL failure:

SQL failed; SQL: SELECT * FROM wp_pod_fields WHERE datatype = ORDER BY weight ASC; Response: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY weight ASC' at line 1

I'm not familiar with classes and SQL to dig it up myself, i just understood that load_ pod_ item works with wp_ pod table (not wp_ pod_ fields) and then refers to some other functions (where datatype doesn't output). Also, i may be wrong, but shouldn't this

$result = pod_query("SELECT tbl_row_id FROM @wp_pod WHERE id = $params->pod_id LIMIT 1",'Item not found',null,'Item not found');

be this

$result = pod_query("SELECT $params->tbl_row_id FROM @wp_pod WHERE id = $params->pod_id LIMIT 1",'Item not found',null,'Item not found');

(classes/PodAPI.php - function load_ pod_ item)?

update. read codex more carefully - looks like that function should output a form (i thought it will return an array of pod item information), but it still acts as before when i leave only $api->load_ pod_ item in the code.

asked Aug 26 '10 at 10:18

Fike

208

edited Aug 26 '10 at 10:43

add comment
enter at least 15 characters

2 Answers

1

As the User Guide states at http://podscms.org/codex/load_pod_item , load_pod_item takes an associative array of named parameters as its only argument:

<?php
$params = array(
    'datatype' => 9,
    'tbl_row_id' => 1
);
$api = new PodAPI();
$whargarbl = $api->load_pod_item($params);
print_r($whargarbl);
?>

Hope this helps.

answered Aug 26 '10 at 10:46

clarinetlord

456

add comment
enter at least 15 characters
0

> associative array

I never see the obvious. Thanks a lot!

answered Aug 26 '10 at 11:36

Fike

208

add comment
enter at least 15 characters