Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I properly merge these two contributions lines together


kittmaster

Recommended Posts

I can't seem to get them to play nice, what is the correct syntax to have both of these lines merged to once continue line?

 

I keep getting t_string errors when I try to copy and paste the parts that are different. Both require SQL access but the order seems to be not important, just not able to find the right syntax to merge them

 

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id, entry_postcode from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");

 

 

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");

 

I need the "entry_postcode from" and the "entry_zone_id from" are the only changes that need merging, other than that the rest of both are identical. Please help!!!

 

 

thanks

 

Chris

Link to comment
Share on other sites

They are the same except the top has one extra field so just use it.

 

Jack

 

Jack

 

The two are similiar except two subtle changes:

 

entry_zone_id, >>>>>>changed to>>>>>>entry_zone_id from " . TABLE_ADDRESS_BOOK blah blah

and

the inclusion of >>>> entry_zone_id from " . TABLE_ADDRESS_BOOK blah blah...

 

I need them to be within the same statement like this:

 

entry_zone_id from " . TABLE_ADDRESS_BOOK blah blah AND entry_zone_id from " . TABLE_ADDRESS_BOOK blah blah...

 

And I keep getting

 

Parse error: parse error, unexpected T_STRING in /homepages/2/d134230169/htdocs/GForce/shoppingbeta/login.php on line 82

 

I hope this helps......:(

 

both statements work indepently but when I try to coming all the "elements" in the forms needed.....(two contribs modifing the same statement) I get the error above.

 

Here is the statement as I modified it in its current form

 

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . entry_postcode from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'], entry_postcode from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] ."'");

 

thanks for the fast response.........any other ideas???

 

Chris

Edited by kittmaster
Link to comment
Share on other sites

I THINK I fixed it by doing this:

 

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id, entry_zone_id and entry_postcode from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");

 

I don't have a parse error any more, so it seems to be working correctly...........I just "anded" the two together using the same parse variables, hopefully its stable........can anyone see an issue with it?

 

Chris

Link to comment
Share on other sites

No, that is not correct. If you look closely, the only difference between the first and the second lines you posted is the one change I mentioned. In the last one you made a duplicate entry and aded the word and.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

No, that is not correct. If you look closely, the only difference between the first and the second lines you posted is the one change I mentioned. In the last one you made a duplicate entry and aded the word and.

 

Jack

 

I understand what you are saying, but both of those variables are trying to access the DB. Maybe I'm just misunderstanding what your saying. Could you rearrange this so I can see what its supposed to look like?

 

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id, entry_zone_id and entry_postcode from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");

 

I appreciate the feedback and help

 

Chris

Link to comment
Share on other sites

You asked how to merge the two. If that is still your question, then it's

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id, entry_postcode from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");

Does that not work the way you want it to?

 

Jack

Edited by Jack_mcs

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

You asked how to merge the two. If that is still your question, then it's
$check_country_query = tep_db_query("select entry_country_id, entry_zone_id, entry_postcode from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");

Does that not work the way you want it to?

 

Jack

 

 

It works in this form, entry_zone_id, > but should be written entry_zone_id from " . TABLE_ADDRESS_BOOK

 

just as entry_postcode is set up. Both of these variables should be pulling data from the TABLE_ADDRESS_BOOK. in which as it stands now, only one of them is pull the data from the table. That is why I put the "AND" statement for both of them to use that data from the table. When I try to bring them together any other way, I get that parse error

Link to comment
Share on other sites

In the select part of the database query, each item has to be separated by a comma except for the last one. So it should be

select entry_country_id, entry_zone_id, entry_postcode

If you try to remove the comma after entry_zone_id it won't work. I just copied the statement I posted into a test shop and it works fine. If you are getting an error, it must be from something else.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

In the select part of the database query, each item has to be separated by a comma except for the last one. So it should be
select entry_country_id, entry_zone_id, entry_postcode

If you try to remove the comma after entry_zone_id it won't work. I just copied the statement I posted into a test shop and it works fine. If you are getting an error, it must be from something else.

 

Jack

 

 

Ok so the criteria for this line entry is item1, item2, item3, item4, item blah blah from database_table etc.....

 

That makes sense, it just seemed like it I had to have a special format for different variable accessing. I think I got it.

 

Thanks

Chris

Link to comment
Share on other sites

Jack

 

I followed your responses exactly and adding in the missing fields with the "," etc worked exactly as it should. I just didn't understand why they needed addition that way.

 

But I do now with your help.

 

Thanks again for everything........onto the next contrib........;)

 

Chris

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...