chrometweaks.org

Whats a good iPage web hosting and designing site? (Its a clan gaming site)?

Click Here To View All Answers...


Got a question, hope someone can answer... Whats a good iPage web hosting and designing site? (Its a clan gaming site)? Hoping for any answer or 2. My 2nd question... Hello everyone,.

I need help please. I have a table in the database that is called item_colors. There is 3 columns, product_id, color_name and color_code..

I need to display those color values in a row in the product_info page, something like this:.

<tr>.

<td>color1</td>.

<td>color2</td>.

</tr>.

The problem is I have no idea how to get the values from the database to the product info page. I don't have any experience in php..

Someone please help me..

Thanks.

Far..

Comments (12)

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

Comment #1

Thank you for your reply, but no exactly..

I want to get displayed on the product_info page some values I already have in a table in the database..

What I need is to know what is the code to get that values from the database.

Thanks.

Far..

Comment #2

You need to narrow down your question so we understand..

Are you looking for the exact sql code to pull the data or are you looking for the code for the page layout?.

You need to help us help you by being more specific about what you want to do in as much detail as possible...

Comment #3

Thank you Mibble for your reply..

I'm looking for the exact sql code to pull the data. Here is a detailed explanation..

I have a table in the database with several colors name and colors code. For example; White (color name); #FFFFFF (color code), plus product_id. These values are in the table..

I know that by making an small square table and assigning a color code as background, the table will get that color, then, making a second row and display the color name (White), I will be able to create four o five boxes of different colors assigned previously to that particular product..

My problem is creating the code to pull the color code (#FFFFFF) and the color name (White) from the data and display both inside the product_info page. THis is what I need, how to get values from the database and display in a page..

Because the table has the product_id, when the product info page display the product id 123, the colors assigned to the 123 will be displayed also..

I know some about html, but nothing about php..

I have redesigned the product info page so I have much more control about the layout now, so where to display the colors is not a problem for me..

Thank you for your help..

Far..

Comment #4

Try this:.

Function getcolortable($tablename, $product_id, $num_columns) {.

# Contruct the query.

$query = teb_db_query("SELECT * from $tablename WHERE products_id = $product_id");.

# Fetch the array.

$data = tep_db_fetch_array($query).

# Initialize the container -> *Add whatever parameters needed*.

$table = '<table>'; .

$column = 1;.

# Loop through the data.

For ($i=0, $i<sizeof($data), $i++) {.

 # IF this is the first column start a new row.

 $table .= ($column==1 ? '<tr>' : '');.

 # Construct the cell.

 $table .= '<td bgcolor="'$data['color_code'] .'">'$data['color_name']'</td>';.

 # IF this is the last column then end the row and reset the column counter.

 if ($column == $num_columns) {.

 $column = 1;.

 $table .= '</tr>';.

 } # END if.

 # IF this is the last record end the table.

 if ($i == (sizeof($data)-1) {.

 $table .= '</table>';.

 } # END if.

 # Advance the column counter.

 $column++;.

} # END for loop.

# RETURN the contructed table.

Return $table;.

} # END getcolortable().

Pass the table name, product_id, and desired number of columns to the function and it will return the constructed table. Use it like this:.

<? echo getcolortable('tablename', $product_info['products_id'], 2); ?>.

Hope that helps...be sure to scan it over and tweak as needed..

Bobby..

Comment #5

Bobby,.

I really appreciate your time in doing this for us. I finally get the colors in the product description page, part with your code, and part from another guy, so I'm more than happy for the incredible help received..

Thank you very much..

Far.

Here is the site:.

Http://netpromoservices.com..

Comment #6

Hello everyone,.

I need help please. I have a table in the database that is called item_colors. There is 3 columns, product_id, color_name and color_code..

I need to display those color values in a row in the product_info page, something like this:.

<tr>.

<td>color1</td>.

<td>color2</td>.

</tr>.

The problem is I have no idea how to get the values from the database to the product info page. I don't have any experience in php..

Someone please help me..

Thanks.

Far..

Comment #7

There is a feature in the admin section that allows you to add attributes to your products. Isn't that what you are trying to do?..

Comment #8


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