Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Echo split into 2 columns
Old 02-15-2010, 05:18 PM Echo split into 2 columns
rolda hayes's Avatar
Wannabe Adventurer...

Posts: 961
Name: Darren
Location: England
Trades: 0
Hi,

I need some advise in splitting this echo into a table with 1 row and 2 columns.

The first column needs to be the £{$row['Price_ExVat']} + vat part and the second the link to the buy button.

Hope this makes sense!!

PHP Code:
<?php


//--------------'PRICE BEFORE VAT CODE'---------------------
$strProd_REF "591";
$strCar_ID "def";
$sqlSelect "SELECT Prod_ID, Price_ExVat FROM products WHERE Prod_REF = '" $strProd_REF "' AND Car_ID = '" $strCar_ID "'
"
;

// assign the basic sqlquery
$sqlquery $sqlSelect;

//get the result set
$result mysql_query($sqlquery);
while (
$row mysql_fetch_assoc($result))
{
    echo 
{$row['Price_ExVat']} + vat <a href=\"basket.php?src=".urlencode($_SERVER['REQUEST_URI'])."&productID=" $row["Prod_ID"] . "\"><img src=\"images/addtobasket.jpg\" width=\"55\" height=\"28\" border=\"0\"></a>";
    
//end make while

    
}
    
$row "";
    
mysql_free_result($result); 

//--------------'END PRICE CODE'---------------------

?>
__________________
I Just a test to see what happens...
Please login or register to view this content. Registration is FREE

"Let us be thankful for the fools. But for them the rest of us could not succeed..."
rolda hayes is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-15-2010, 05:30 PM Re: Echo split into 2 columns
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
PHP Code:
<?php
echo ('<table width="xx">');
echo (
'<tr>');
echo (
'<td>');
// cell data column1 goes here
echo ('</td>');
echo (
'<td>');
// cell data column2 goes here
echo ('</td>');
echo (
'</tr>');
echo (
'</table>');
?>
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-15-2010, 05:57 PM Re: Echo split into 2 columns
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
PHP Code:
<?php 


//--------------'PRICE BEFORE VAT CODE'--------------------- 
$strProd_REF "591"
$strCar_ID "def"
$sqlSelect "SELECT Prod_ID, Price_ExVat FROM products WHERE Prod_REF = '" $strProd_REF "' AND Car_ID = '" $strCar_ID "' 
"


// assign the basic sqlquery 
$sqlquery $sqlSelect

//get the result set 
$result mysql_query($sqlquery);
?>
<table>
<?php while ($row mysql_fetch_assoc($result)) : ?>
     <tr>
          <td>
               <?php echo {$row['Price_ExVat']} + vat" ?>
          </td>
          <td>
               <?php echo "<a href=\"basket.php?src=".urlencode($_SERVER['REQUEST_URI'])."&productID=" $row["Prod_ID"] . "\"><img src=\"http://www.webmaster-talk.com/images/addtobasket.jpg\" width=\"55\" height=\"28\" border=\"0\"></a>"?>
          </td>
     </tr>
<?php endwhile; ?>
</table>
<?php
$row 
""
mysql_free_result($result);  

//--------------'END PRICE CODE'--------------------- 

?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 02-15-2010 at 05:59 PM..
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-15-2010, 06:34 PM Re: Echo split into 2 columns
rolda hayes's Avatar
Wannabe Adventurer...

Posts: 961
Name: Darren
Location: England
Trades: 0
Thanks Guys,

Got it working great now!
__________________
I Just a test to see what happens...
Please login or register to view this content. Registration is FREE

"Let us be thankful for the fools. But for them the rest of us could not succeed..."
rolda hayes is offline
Reply With Quote
View Public Profile
 
Old 02-16-2010, 04:05 AM Re: Echo split into 2 columns
rolda hayes's Avatar
Wannabe Adventurer...

Posts: 961
Name: Darren
Location: England
Trades: 0
Another question!

I need to display the price including the vat (tax) at 17.5% , as the database only has the before vat price stored, can I adjust this line to automatically add it?

PHP Code:
<?php echo {$row['Price_ExVat']}?>
__________________
I Just a test to see what happens...
Please login or register to view this content. Registration is FREE

"Let us be thankful for the fools. But for them the rest of us could not succeed..."
rolda hayes is offline
Reply With Quote
View Public Profile
 
Old 02-16-2010, 04:10 AM Re: Echo split into 2 columns
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Just to clarify, you need to apply a 17.5% tax to the number pulled from the database?
PHP Code:
<?php echo '£' round($row['Price_ExVat'] * 1.1752?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-16-2010, 04:56 AM Re: Echo split into 2 columns
rolda hayes's Avatar
Wannabe Adventurer...

Posts: 961
Name: Darren
Location: England
Trades: 0
Thanks Mike,

That is exactly what I am trying to do.

Some of our products need to be displayed before VAT and some including.

This code now saves me HOURS of updating pages!
__________________
I Just a test to see what happens...
Please login or register to view this content. Registration is FREE

"Let us be thankful for the fools. But for them the rest of us could not succeed..."
rolda hayes is offline
Reply With Quote
View Public Profile
 
Old 02-16-2010, 05:06 AM Re: Echo split into 2 columns
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Using a constant for the VAT multiplier can also be advantageous.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-16-2010, 05:42 AM Re: Echo split into 2 columns
rolda hayes's Avatar
Wannabe Adventurer...

Posts: 961
Name: Darren
Location: England
Trades: 0
Ahh, now that IS a good point Chris...

If (when) the government decide to play with the vat rate again, it would mean changing the code on ALL the buttons...!
__________________
I Just a test to see what happens...
Please login or register to view this content. Registration is FREE

"Let us be thankful for the fools. But for them the rest of us could not succeed..."
rolda hayes is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Echo split into 2 columns
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.62564 seconds with 12 queries