Zen Cart Logo
Forums / General Questions / Trying to create a new function and page, cachable fatal error....

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

Locked

Views: 1,177

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
11 Mar 2010, 3:14 AM
#1
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

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   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!

11 Mar 2010, 4:40 AM
#2
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

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

I've changed it to this now:

<?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.

11 Mar 2010, 4:52 AM
#3
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

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

It's working with this:

<?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.

11 Mar 2010, 5:03 AM
#4
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

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

jettrue:

It's working with this:

<?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?

11 Mar 2010, 5:11 AM
#5
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

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. :)