0

I want to include some variables in an HTML table. The variables are stored in phpmyadmin and my site a CartWeaver site, I'm using Dreamweaver.

How do I insert variables into separate table cells? I thought this would work but it isn't so:

<?php echo($row_rsCWResults["product_ShortDescription"] . "<br />") ?>
2
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by CFROG
0

Much simpler:

What is the code to display the value of the field "product_style" in an HTML table cell?

0

Your pulling this $row_rsCWResults["product_ShortDescription"] from a separate page in your script.

The best option for what you have going on is to query the db again to pull that value for the page where it's needed.

A generic query would look something like this ... you can fill in the table info as needed.

$query=mysql_query("SELECT col_name FROM table_name WHERE  col_name='$some_value'");
while($row=mysql_fetch_array($query)){
$product=$row['col_name'];}

echo "$product"; 
// OR 
<?=$product?>
0

my database is qcdb my table is tbl_products and the variable is product_style, how does it go?

what is $some_value?

Edited by IAuchmoody27: n/a

0

Assuming that you have more than one product style listed in your table, $some_value would be the specific product style you want to display. Let's say you have 3 different product styles (example1, example2, and example3) and you want to display the product style of example2.

$query=mysql_query("SELECT product_style FROM tbl_products WHERE  product_style='example2'");
while($row=mysql_fetch_array($query)){
$product=$row['product_style'];}
 
echo "$product"; // <-- will output 'example2'

You can pull other information as well related to that item. Price, description, etc.
It may be worth for it for you to check out a tutorial that will break it down for you step by step and you can try a few things out for yourself.
http://www.w3schools.com/php/default.asp

0

I'll be hammering as many tuts as I can over the weekend. I'm not sure we're talking about the same thing though.

I want it to pull the style associated with the current product, not pull the product according to the style I want, though..

0

That wouldn't be a problem at all, the query just needs to be changed a bit.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.