I dunno what I have done wrong here... When I try to add a new item, a new row is created but there is no info in it.
When I print_r($args) in the beginning of the _create file i get;
Array ( [categoryid] => [parentstoryid] => [title] => [summary] => [story] => [ratingid] => [image] => [char1] => [char2] => [genre] => [author] => [email] => [date] => [updated] => [roundrobin] => [unvalidated] => [counter] => [keywords] => )
Where should I check for error?
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Creates new row but no info in it.
-
- Rank: Registered User
- Registered: Sep 12, 2002
- Last visit: Mar 23, 2009
- Posts: 47
-
**unknown user**
- Rank: Senior
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 2330
You can print_r() at various points in the module. Just follow the progression of the data with print_r()...that should help determine where the data is being lost. Without the code, that's about all one could say. -
- Rank: Registered User
- Registered: Sep 12, 2002
- Last visit: Mar 23, 2009
- Posts: 47
Here is the code.. I'm so sick of this problem now
function Writer_stories_create($args)
{
list($categoryid,
$parentstoryid,
$title,
$summary,
$story,
$ratingid,
$image,
$char1,
$char2,
$genre,
$author,
$email,
$date,
$updated,
$roundrobin,
$unvalidated,
$counter,
$keywords) = pnVarPrepForStore($categoryid,
$parentstoryid,
$title,
$summary,
$story,
$ratingid,
$image,
$char1,
$char2,
$genre,
$author,
$email,
$date,
$updated,
$roundrobin,
$unvalidated,
$counter,
$keywords );
extract($args);
if (!pnSecConfirmAuthKey()) {
pnSessionSetVar('errormsg', pnVarPrepHTMLDisplay(_BADAUTHKEY));
pnRedirect(pnModURL('Writer', 'stories', 'view'));
return true;
}
if (!pnModAPILoad('Writer', 'stories')) {
pnSessionSetVar('errormsg', pnVarPrepHTMLDisplay(_LOADFAILED11));
pnRedirect(pnModURL('Writer', 'stories', 'view'));
return true;
}
$storyid = pnModAPIFunc('Writer',
'stories',
'create',
array('categoryid' => $categoryid,
'parentstoryid' => $parentstoryid,
'title' => $title,
'summary' => $summary,
'story' => $story,
'ratingid' => $ratingid,
'image' => $image,
'char1' => $char1,
'char2' => $char2,
'genre' => $genre,
'author' => $author,
'email' => $email,
'date' => $date,
'updated' => $updated,
'roundrobin' => $roundrobin,
'unvalidated' => $unvalidated,
'counter' => $counter,
'keywords' => $keywords));
if ($storyid) {
// Success
pnSessionSetVar('statusmsg', pnVarPrepHTMLDisplay(_EXAMPLECREATED));
}
// This function generated no output, and so now it is complete we redirect
// the user to an appropriate page for them to carry on their work
pnRedirect(pnModURL('Writer', 'stories', 'view'));
// Return
return true;
}
__________________________________________________
function Writer_storiesapi_create($args)
{
extract($args);
// Argument check - make sure that all required arguments are present,
// if not then set an appropriate error message and return
if ((!isset($categoryid)) ||
(!isset($parentstoryid)) ||
(!isset($title)) ||
(!isset($summary)) ||
(!isset($story)) ||
(!isset($ratingid)) ||
(!isset($image)) ||
(!isset($char1)) ||
(!isset($char2)) ||
(!isset($genre)) ||
(!isset($author)) ||
(!isset($email)) ||
(!isset($date)) ||
(!isset($updated)) ||
(!isset($roundrobin)) ||
(!isset($unvalidated)) ||
(!isset($counter)) ||
(!isset($keywords))) {
/*(isset($categoryid) && !is_numeric($categoryid)) ||
(isset($parentstoryid) && !is_numeric($parentstoryid)) ||
(isset($ratingid) && !is_numeric($ratingid)) ||
(isset($roundrobin) && !is_numeric($roundrobin)) ||
(($unvalidated) && !is_numeric($unvalidated)) ||
(isset($counter) && !is_numeric($counter))) */
pnSessionSetVar('errormsg', _MODARGSERROR1);
return false;
}
if (!pnSecAuthAction(0, 'Writer::', "$categoryid::", ACCESS_ADD)) {
pnSessionSetVar('errormsg', _MODULENOAUTH);
return false;
}
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
$Storiestable =&$pntable['writer_stories'];
$Storiescolumn =&$pntable['writer_stories_column'];
$nextId = $dbconn->GenId($Storiestable);
list($categoryid,
$parentstoryid,
$title,
$summary,
$story,
$ratingid,
$image,
$char1,
$char2,
$genre,
$author,
$email,
$date,
$updated,
$roundrobin,
$unvalidated,
$counter,
$keywords) = pnVarPrepForStore($categoryid,
$parentstoryid,
$title,
$summary,
$story,
$image,
$ratingid,
$char1,
$char2,
$genre,
$author,
$email,
$updated,
$roundrobin,
$unvalidated,
$counter,
$keywords);
$SQL = "INSERT INTO $Storiestable (
$Storiescolumn[storyid],
$Storiescolumn[categoryid],
$Storiescolumn[parentstoryid],
$Storiescolumn[title],
$Storiescolumn[summary],
$Storiescolumn[story],
$Storiescolumn[image],
$Storiescolumn[ratingid],
$Storiescolumn[char1],
$Storiescolumn[char2],
$Storiescolumn[genre],
$Storiescolumn[author],
$Storiescolumn[email],
$Storiescolumn[updated],
$Storiescolumn[roundrobin],
$Storiescolumn[unvalidated],
$Storiescolumn[counter],
$Storiescolumn[keywords])
VALUES (
'".(int)$nextId."',
'".(int)$categoryid."',
'".(int)$parentstoryid."',
'".$title."',
'".$summary."',
'".$story."',
'".$image."',
'".$ratingid."',
'".$char1."',
'".$char2."',
'".$genre."',
'".$author."',
'".$email."',
'".$updated."',
'".(int)$roundrobin."',
'".(int)$unvalidated."',
'".(int)$counter."',
'".$keywords."'
)";
$dbconn->Execute($SQL);
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', _EXAMPLECREATEFAILED);
return false;
}
$storyid = $dbconn->PO_Insert_ID($Storiestable, $Storiescolumn['storyid']);
pnModCallHooks('item', 'create', $storyid, 'storyid');
return $storyid;
}
-
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 395
i been error checking all weekend heheheh
from the way you describe your problem the first place i would check is the SQL statement.
print_r($SQL);
die;
right below the statement, and then run whe output in phpMyAdmin.
- Moderated by:
- Support
