Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2005
    Location
    USA, St. Louis
    Posts
    3,710
    Plugin Contributions
    9

    Default Trying to create a new function and page, cachable fatal error....

    Bascially I've created a new table in zen cart with email addresses and activation codes, and I'm trying to hack a way for an activation code to be displayed on the page when the correct code is entered. The php looks like this:

    PHP Code:
    <?php   require('includes/application_top.php');?>
    <form enctype="application/x-www-
    form-urlencoded" method="get" >Enter the GC Number printed on the
    Coin:<input name="gcnumber" type="text" /> <input type="submit"
    value="Submit" /></form>

    <?php $activation_code $db->Execute("select ActivationCode from
    wp_activation_codes where GCcode = '" 
    $_GET['gcnumber'] . "'");
    if (isset(
    $activation_code)) {
    echo 
    $activation_code; }
    ?>
    I"m getting this error in my debug log:

    PHP Catchable fatal error: Object of class queryFactoryResult could not be converted to string in /home/c1711enf/public_html/shop/testing_copy.php on line 10

    line 10 is the echo line.

    I'm not sure if I'm doing the form right either. I'm basically hacking bits of old code to try and get this to work. Please help! Thanks!

  2. #2
    Join Date
    Jan 2005
    Location
    USA, St. Louis
    Posts
    3,710
    Plugin Contributions
    9

    Default Re: Trying to create a new function and page, cachable fatal error....

    I've changed it to this now:

    PHP Code:
    <?php   require('includes/application_top.php');?>
    <form enctype="application/x-www-
    form-urlencoded" method="get" >Enter the GC Number printed on the
    Coin:<input name="gcnumber" type="text" /> <input type="submit"
    value="Submit" /></form>

    <?php if (isset($_GET['gcnumber'])) {
    $activation_code $db->Execute("select ActivationCode from
    wp_activation_codes where GCcode = '" 
    . (int)$_GET['gcnumber'] . "'");
    if (isset(
    $activation_code)) {
    echo 
    $activation_code->fields['ActivationCode']; }

     
    ?>
    Now I just need it to "echo" the results on the page. I'm sure I'm not doing the form or perhaps the "echo" correct.

  3. #3
    Join Date
    Jan 2005
    Location
    USA, St. Louis
    Posts
    3,710
    Plugin Contributions
    9

    Default Re: Trying to create a new function and page, cachable fatal error....

    It's working with this:

    PHP Code:
    <?php   require('includes/application_top.php');?>
    <form enctype="application/x-www-
    form-urlencoded" method="get" >Enter the GC Number printed on the
    Coin:<input name="gcnumber" type="text" /> <input type="submit"
    value="Submit" /></form>
    <?php if (isset($_GET['gcnumber'])) {
    $activation_code $db->Execute("select ActivationCode from
    wp_activation_codes where GCcode = '" 
    $_GET['gcnumber'] . "'");
    if ((
    $activation_code->fields['ActivationCode']) !='') {
    echo 
    $activation_code->fields['ActivationCode']; }

    ?>
    Still not getting anything echo'd. :) Please help.

  4. #4
    Join Date
    Jan 2005
    Location
    USA, St. Louis
    Posts
    3,710
    Plugin Contributions
    9

    Default Re: Trying to create a new function and page, cachable fatal error....

    Quote Originally Posted by jettrue View Post
    It's working with this:

    PHP Code:
    <?php   require('includes/application_top.php');?>
    <form enctype="application/x-www-
    form-urlencoded" method="get" >Enter the GC Number printed on the
    Coin:<input name="gcnumber" type="text" /> <input type="submit"
    value="Submit" /></form>
    <?php if (isset($_GET['gcnumber'])) {
    $activation_code $db->Execute("select ActivationCode from
    wp_activation_codes where GCcode = '" 
    $_GET['gcnumber'] . "'");
    if ((
    $activation_code->fields['ActivationCode']) !='') {
    echo 
    $activation_code->fields['ActivationCode']; }

    ?>
    Still not getting anything echo'd. :) Please help.
    I didn't meant to post the part in bold.

    It is echo'ing now. However, I have another problem. Once the form is submitted, it appends what was entered into the form at the end of the url after a question mark. Is there anyway to stop this?

  5. #5
    Join Date
    Jan 2005
    Location
    USA, St. Louis
    Posts
    3,710
    Plugin Contributions
    9

    Default Re: Trying to create a new function and page, cachable fatal error....

    Ok, I figured out this issue to, I simply changed the form from GET to POST.

    Really learning a lot here. Sorry I'm taking up space figuring things out. :)

 

 

Similar Threads

  1. Replies: 4
    Last Post: 10 Nov 2018, 01:32 PM
  2. Autoload Function- Fatal Error
    By stars62 in forum General Questions
    Replies: 1
    Last Post: 1 Dec 2009, 09:12 PM
  3. Replies: 0
    Last Post: 10 Nov 2008, 02:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR