Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Debug Create Account Post code


ecclesr

Recommended Posts

Hi,

 

In my Create_account.php I have modified the code to lookup against a database table of post codes to validate that the post code entered is a post code known by the website.

 

The problem I have is that I am unable to see the results of the code change ie I have been unable to debug/test the change to see a message that the post code is unknown. i have used php print_r and echo to try to debug the code change but todate I am unable to see the results. How would one debug the following code modification in create_account.php -ie where would you place debug code

 

The modified code is

 

    if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
  $error = true;

     $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
  } else {
    $check_postcode_query = tep_db_query("select count(*) as total from bulletfreight_zones where bf_postcode = '" . tep_db_input($postcode) . "'");
    $check_postcode = tep_db_fetch_array($check_postcode_query);

    if ($check_postcode['total'] = 0) {
      $error = true;

      $messageStack->add('create_account', ENTRY_POST_CODE_NOTFOUND_ERROR);
    }
   }

 

 

This code change ie consumming a lot of my time i would like to be able to move on to other work once I know the code change works

 

Thank you all in advance

Link to comment
Share on other sites

You could try this

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

To check if it works you can i.e. add a success message to your code:

 

$messageStack->add('create_account', ENTRY_POST_CODE_FOUND, 'success');

 

Try the above change and still nothing

 

1. Is my initial query code correct

 

2. where in the job should I place the "debug" code and in which jobs must the code be put to support my code change

 

Thanking you in advance

Link to comment
Share on other sites

Maybe just a simple programming error:

 

if ($check_postcode['total'] = 0) {

Should probably be:

 

if ($check_postcode['total'] == 0) {

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Maybe just a simple programming error:

 

if ($check_postcode['total'] = 0) {

Should probably be:

 

if ($check_postcode['total'] == 0) {

Your answer was correct thank you.

 

I thank you for systematically looking at my problem and offering a practical solution

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...