chrometweaks.org

Using iPage.com for testing purposes?

Click Here To View All Answers...


Quick question... Using iPage.com for testing purposes? Thanks for any response. Another question I got... Hey everyone. I'm going to go out on a limb here at the risk of sounding stupid, but i'm really trying to understand the php code and I have a few questions that may seem trivial. I'm looking at the following set of code:.

If (isset($HTTP_GET_VARS['products_id'])) { $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from "TABLE_MANUFACTURERS" m left join "TABLE_MANUFACTURERS_INFO" mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '"(int)$languages_id"'), "TABLE_PRODUCTS" p where p.products_id = '"(int)$HTTP_GET_VARS['products_id']"' and p.manufacturers_id = m.manufacturers_id"); if (tep_db_num_rows($manufacturer_query)) { $manufacturer = tep_db_fetch_array($manufacturer_query);?>.

This is from catalog/includes/boxes/manufacturer's_info....

First, why dies the query use the prefixes m as in m.manufacturers_id and then later in the same line it uses the mi as in mi.manufacturers_url. Why are they different?.

Second, in relation to this, on my iPage site in the manufactuers box, the link for manufacturers homepage is not working...just comes up as a blank redirected page. Looking at this code above, it occurred to me that the manufacturers_url is actually in the TABLE_MANUFACTURERS_INFO and not the TABLE_MANUFACTURERS, so is the above code a mistake?.

Lastly, and this may seem the most idiotic, but what exactly does tep refer to. It seems that it's like the echo command, but I could find no reference to it in the php.net site, nor to any of these other questions..

Thanks for anyone who can help me understand this. I'm trying to build a basic understanding of php. Any help is greatly appreciated!!!.

Thanks again,.

Rick..

Comments (78)

I would like to know the answer too. Anyone here know what is the answer. I'll do some research in Google and get back to you if I got an anything. You should email the people at iPage as they probably could assist you..

Comment #1

Yup, peterr is right. Let me clarify a bit:.

M.manufacturers_image, mi.manufacturers_url.

This is shorthand, telling SQL to select the column "manufacturers_image" from table "m" and the column "manufacturers_url" from table "mi". Obviously there are not any tables named "m" or "mi" in your database, but if you look a little further:.

From "TABLE_MANUFACTURERS" m left join "TABLE_MANUFACTURERS_INFO" mi.

"TABLE_MANUFACTURERS" is an osCommerce constant (set in database_tables.php) that is translated as simply "manufacturers" when it's sent to sql. This part of the query tells SQL to use the table called "manufacturers," but we're going to call it "m" for right now. We're also pulling things from "manufacturers_info" and calling it "mi." These are called "aliases" and last only until the end of the query..

If you need to, you have more than one alias per table in a query. It comes in handy sometimes..

You could do this instead:.

Manufacturers.manufacturers_image, manufacturers_info.manufacturers_url.

Then you don't need the second part above that gives each table an alias. However, I'm sure you can see how this could get very time consuming and bloat your code..

"tep" is short for "The Exchange Project." That's the former name of osCommerce. When Milestone 3 comes out, all functions will be renamed to "osc_whatever()."..

Comment #2

Much thanks for both responses. That definately makes things a lot clearer! I've been trying to go through the tutorial at php.net. Is this the best way of learning the basics or can someone perhaps recommend a book or another iPage website that may be a little bit clearer for someone who is very new to all this?.

Again, much thanks for all the help!!!.

Rick..

Comment #3

Php.net is great help, so is the tutorial section at mysql.com. Honestly, the best way I know to learn is to jump in and do it...

Comment #4

Okay, thanks again for all the help! small steps first....

Rick..

Comment #5

Hi,.

I would highly recommend Sitepoint forums, at.

Http://www.sitepoint.com/forums/.

The PHP forums are very helpful, there is a sub forum at.

Http://www.sitepoint...splay.php?f=168.

, devoted to tutorials and resources..

Especially, see this thread:.

Http://www.sitepoint...ead.php?t=18699.

Peter..

Comment #6

I use this:.

Http://www.amazon.co.uk/exec/obidos/ASIN/0...4580661-3148462.

This post has been edited by.

Yesudo.

: 29 April 2004, 00:40..

Comment #7

Hey everyone. I'm going to go out on a limb here at the risk of sounding stupid, but i'm really trying to understand the php code and I have a few questions that may seem trivial. I'm looking at the following set of code:.

If (isset($HTTP_GET_VARS['products_id'])) { $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from "TABLE_MANUFACTURERS" m left join "TABLE_MANUFACTURERS_INFO" mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '"(int)$languages_id"'), "TABLE_PRODUCTS" p where p.products_id = '"(int)$HTTP_GET_VARS['products_id']"' and p.manufacturers_id = m.manufacturers_id"); if (tep_db_num_rows($manufacturer_query)) { $manufacturer = tep_db_fetch_array($manufacturer_query);?>.

This is from catalog/includes/boxes/manufacturer's_info....

First, why dies the query use the prefixes m as in m.manufacturers_id and then later in the same line it uses the mi as in mi.manufacturers_url. Why are they different?.

Second, in relation to this, on my iPage site in the manufactuers box, the link for manufacturers homepage is not working...just comes up as a blank redirected page. Looking at this code above, it occurred to me that the manufacturers_url is actually in the TABLE_MANUFACTURERS_INFO and not the TABLE_MANUFACTURERS, so is the above code a mistake?.

Lastly, and this may seem the most idiotic, but what exactly does tep refer to. It seems that it's like the echo command, but I could find no reference to it in the php.net site, nor to any of these other questions..

Thanks for anyone who can help me understand this. I'm trying to build a basic understanding of php. Any help is greatly appreciated!!!.

Thanks again,.

Rick..

Comment #8

Hi,.

I'm no PHP guru, but I'll attempt to answer some of your questions..

They are aliases, and you can give them any name you like. The reason a diff prefix is used is std SQL stuff. it's because it is after the "LEFT JOIN", to distinguish the right table from the left. One table is 'manufacturers', the other is 'manufacturers_info'..

No, the SQL select, if you follow it through, is selecting the 'url' from the table 'manufacturers..

It is a standard in osCommerce, used for many (osC) functions..

Peter..

Comment #9


This question was taken from a support group/message board and re-posted here so others can learn from it.