41
astaldaran
Can you look over
  • 2004/10/9 18:08

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


I get an error on a admin page of a module i made. This is my first module and the admin section is giving me trouble. Once i turned on the php debug I get the error

Quote:
Fatal error: Call to a member function on a non-object in /home/tamkin/public_html/redemptionmg/modules/qmagic/admin/index.php on line 102



Line 102 contains
$xoopsTpl->assign('quotes'$quotes);


Here is the entire code(minus begining and end tags and info):

$xoopsOption['template_main'] = 'quote_admin.html';
include (
'admin_header.php');
xoops_cp_header();
$table $xoopsDB->prefix('qmagic');
//check to see if there is a quote to be deleted
    
if (isset($_POST['Delete']))
    {
        
$dindex $_POST['qindex'];
        
$query "DELETE FROM $table WHERE index='$dindex'";
        
$xoopsDB -> query($query);

            
$xoopsTpl->assign('message'_MD_QM_DELETED);
    }
//checks to see if a quote needs approved
    
if (isset($_POST['Approve']))
    {
        
$uindex $_POST['qindex'];
        
$query "UPDATE $table SET $table.approved = '1' WHERE index='$uindex'";

             
$xoopsTpl->assign('message'_MD_QM_APPROVED);

    }
    
//checks to see if a quote needs updated
    
if (isset($_POST['S1']))
    {
        
$uindex $_POST['qindex'];
        
$quote $_POST['S1'];
        
$query "UPDATE $table SET $table.quote = '$quote' WHERE index='$uindex'";

            
$xoopsTpl->assign('message'_MD_QM_UPDATED);

    }
    
    
//gets all the quotes and lines them up with the user names of the submitters

$userdb $xoopsDB->prefix('users');
$query "SELECT $table.qid, $table.quote, $userdb.uname FROM $table$userdb WHERE $table.uid = $userdb.uid AND $table.approved = 0 ORDER by $table.qid desc";
$result $xoopsDB -> query($query);
//$R = mysql_num_rows($result);
$R $xoopsDB -> getRowsNum($result);
           
$i 0;
           while (
$i $R) {
           @
$qaprove=mysql_result($result,$i,"approved");
           @
$qindex=mysql_result($result,$i,"index");
           @
$qcontent=mysql_result($result,$i,"quote");
           @
$quser_name=mysql_result($result,$i,"uname");
            
$quotes $quotes."<table border="1" width="552" height="1">"
            
."<tr>"
            
."<form method="POST" action="">"
            
."<td width="63" height="1"><input type="submit value="_MD_QM_DELETE" name=Delete"></td>"
            
."<input type="hidden" value="$qindex" name="$qindex">"
            
."</form>";
            if (
$qaprove 0)
            {
            
$quotes $quotes."<form method="POST" action="">"
            
."<td width="64"><input type="submit" value="_MD_QM_APPROVE" name="Approve">"
            
."<input type="hidden" value="$qindex" name="$qindex">"
            
."</form>";
            }
            
$quotes $quotes."<td width="160" height="1">"
            
."User:  $quser_name"
            
."</td>"
            
."</tr>"
            
."</table>"
            
."<form method="POST" action="">"
            
."<p><textarea rows="5" name="S1" cols=50" value="$qcontent"></textarea></p>"
            ."
<input type="hidden" value="$qindexname="$qindex">"
            ."
</form>";

           ++
$i;
           }

           
$xoopsTpl->assign('quotes', $quotes);


xoops_cp_footer();


I don't know what the problem is...



42
astaldaran
Re: Trouble Programming an administration script
  • 2004/8/17 1:54

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


any other suggestions (I assume someone does module dev...) ? I am just a bit confused...



43
astaldaran
Re: Custom Survey Module...Does One Exist?
  • 2004/8/13 19:17

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


I have also been thniking of making a survey module. IT would also allow for admin input (say I was at an event and took a paper survey of everyone there, I could then insert them all into the survey back on the site) I may start this project, but first I have to master the administration interface (giving me trouble) also I think I would need to get someone to do the coding for generating graphs.



44
astaldaran
Re: Trouble Programming an administration script
  • 2004/8/13 14:07

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


I am not getting any parse errors, I read this guide already.


Ok for most of my module I use the templates and such to display data, should I do the same for the administration part of the module? I didn't because in the newbb administration they don't.



45
astaldaran
Re: Trouble Programming an administration script
  • 2004/8/12 19:57

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


well since no one seems to know what is wrong with this, here is a simple question.

What is the correct way to go about making an administrative page?



46
astaldaran
Re: Trouble Programming an administration script
  • 2004/8/12 19:29

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


I am having a problem that deals with administratino script.

I went and looked at newbb and it uses "echo" statements in the administration page and some other functions so I copied off it. However when I got there the header/footer of admin panel are displayed but my data is not. Anyone know why?

<?
include 
'../../../include/cp_header.php';
xoops_cp_header();
$table $xoopsDB->prefix('qmagic');
//check to see if there is a quote to be deleted
    
if (isset($_POST['Delete']))
    {
        
$dindex $_POST['qindex'];
        
$query "DELETE FROM $table WHERE index='$dindex'";
        
$xoopsDB -> query($query);

            echo 
_MD_QM_DELETED;

    }
//checks to see if a quote needs approved
    
if (isset($_POST['Approve']))
    {
        
$uindex $_POST['qindex'];
        
$query "UPDATE $table SET $table.approved = '1' WHERE index='$uindex'";

            echo 
_MD_QM_APPROVED;

    }
    
//checks to see if a quote needs updated
    
if (isset($_POST['S1']))
    {
        
$uindex $_POST['qindex'];
        
$quote $_POST['S1'];
        
$query "UPDATE $table SET $table.quote = '$quote' WHERE index='$uindex'";

            echo 
_MD_QM_UPDATED;

    }
    
    
//gets all the quotes and lines them up with the user names of the submitters

$userdb $xoopsDB->prefix('users');
$query "SELECT $table.index, $table.quote, $table.approved, $userdb.uname, from $table$userdb order by $table.index desc WHERE $table.user_id = $userdb.uid";
$result $xoopsDB -> query($query);
//$R = mysql_num_rows($result);
$R $xoopsDB -> getRowsNum($result);
           
$i 0;
           while (
$i $R) {
           @
$qaprove=mysql_result($result,$i,"approved");
           @
$qindex=mysql_result($result,$i,"index");
           @
$qcontent=mysql_result($result,$i,"quote");
           @
$quser_name=mysql_result($result,$i,"uname");
            echo 
"<table border="1" width="552" height="1">"
            
."<tr>"
            
."<form method="POST" action="">"
            
."<td width="63" height="1"><input type="submit value="_MD_QM_DELETE" name=Delete"></td>"
            
."<input type="hidden" value="$qindex" name="$qindex">"
            
."</form>";
            if (
$qaprove 0)
            {
            Echo 
"<form method="POST" action="">"
            
."<td width="64"><input type="submit" value="_MD_QM_APPROVE" name="Approve">"
            
."<input type="hidden" value="$qindex" name="$qindex">"
            
."</form>";
            }
            echo 
"<td width="160" height="1">"
            
."User:  $quser_name"
            
."</td>"
            
."</tr>"
            
."</table>"
            
."<form method="POST" action="">"
            
."<p><textarea rows="5" name="S1" cols=50" value="$qcontent"></textarea></p>"
            ."
<input type="hidden" value="$qindexname="$qindex">"
            ."
</form>";

           ++
$i;
           }
           


xoops_cp_footer();
?>



47
astaldaran
Re: I Want to make a Hack....
  • 2004/8/12 15:40

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


This sounds more like a module, I would take a look at the module development documentation (there is not much, but enough to start)



48
astaldaran
Re: Quote Magic Module
  • 2004/8/12 14:53

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


I took a look at the system admin files and they all use echo, that is why I am. Anybody work with the admin itnerface understand why this is not working?



49
astaldaran
Re: Quote Magic Module
  • 2004/8/12 12:59

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


What is wrong with this code? I am not getting any output (this is in the admin menu, and I left out the document info that is why there is no php tag)

include '../../../include/cp_header.php';
xoops_cp_header();
$table $xoopsDB->prefix('qmagic');
//check to see if there is a quote to be deleted
    
if (isset($_POST['Delete']))
    {
        
$dindex $_POST['qindex'];
        
$query "DELETE FROM $table WHERE index='$dindex'";
        
$xoopsDB -> query($query);

            echo 
_MD_QM_DELETED;

    }
//checks to see if a quote needs approved
    
if (isset($_POST['Approve']))
    {
        
$uindex $_POST['qindex'];
        
$query "UPDATE $table SET $table.approved = '1' WHERE index='$uindex'";

            echo 
_MD_QM_APPROVED;

    }
    
//checks to see if a quote needs updated
    
if (isset($_POST['S1']))
    {
        
$uindex $_POST['qindex'];
        
$quote $_POST['S1'];
        
$query "UPDATE $table SET $table.quote = '$quote' WHERE index='$uindex'";

            echo 
_MD_QM_UPDATED;

    }
    
    
//gets all the quotes and lines them up with the user names of the submitters

$userdb $xoopsDB->prefix('users');
$query "SELECT $table.index, $table.quote, $table.approved, $userdb.uname, from $table$userdb order by $table.index desc WHERE $table.user_id = $userdb.uid";
$result $xoopsDB -> query($query);
//$R = mysql_num_rows($result);
$R $xoopsDB -> getRowsNum($result);
           
$i 0;
           while (
$i $R) {
           @
$qaprove=mysql_result($result,$i,"approved");
           @
$qindex=mysql_result($result,$i,"index");
           @
$qcontent=mysql_result($result,$i,"quote");
           @
$quser_name=mysql_result($result,$i,"uname");
            echo 
"<table border="1" width="552" height="1">"
            
."<tr>"
            
."<form method="POST" action="">"
            
."<td width="63" height="1"><input type="submit value="_MD_QM_DELETE" name=Delete"></td>"
            
."<input type="hidden" value="$qindex" name="$qindex">"
            
."</form>";
            if (
$qaprove 0)
            {
            Echo 
"<form method="POST" action="">"
            
."<td width="64"><input type="submit" value="_MD_QM_APPROVE" name="Approve">"
            
."<input type="hidden" value="$qindex" name="$qindex">"
            
."</form>";
            }
            echo 
"<td width="160" height="1">"
            
."User:  $quser_name"
            
."</td>"
            
."</tr>"
            
."</table>"
            
."<form method="POST" action="">"
            
."<p><textarea rows="5" name="S1" cols=50" value="$qcontent"></textarea></p>"
            ."
<input type="hidden" value="$qindexname="$qindex">"
            ."
</form>";

           ++
$i;
           }
           


xoops_cp_footer();
?>



50
astaldaran
Re: Is this website made with Xoops?
  • 2004/8/12 3:10

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


No you don't, you just get the html output.




TopTop
« 1 2 3 4 (5) 6 7 8 »



Login

Who's Online

241 user(s) are online (162 user(s) are browsing Support Forums)


Members: 0


Guests: 241


more...

Donat-O-Meter

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

Latest GitHub Commits