Jump to content

richard_PHP

Members
  • Posts

    79
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

richard_PHP's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for the reply. I've looked at the source code and compared it with the PHP code and the only thing that is standing out which could be the cause is the IF statement itself. With a limited amount of knowledge in PHP I've tried to change it around as far as I can but nothing is working. Any further help/hints? Thanks EDIT: This is the source code around the problem area: <td class="dataTableContent" align="right" valign="top">£1.75</td> 6.00<td class="dataTableContent" valign="top" align="right">6</td> <td class="dataTableContent" align="right" valign="top">£10.50</td> </tr> <tr><td colspan="8"><hr /></td></tr>
  2. Hello all, After putting in a bit of short integer coding into what is an invoice page, the original string is echoed above where it should appear (see image). As indicated by the green arrow, the 6.00 is what showed up before the code was put in, the code addition now has the 'Qty' column displaying how I want, but has the '6.00' showing. I've had a look at the code and cannot find anything in the code which is causing this. Help much appreciated! Code: echo ' </td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . $num = $order->products[$i]["qty"]; if(intval($num) == $num){ $num = intval($num); } echo '<td class="dataTableContent" valign="top" align="right">' . $num . '</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n"; echo ' </tr>' . "\n"; }
  3. Hello all, I've recently made a post about intval, which was solved. However, the result now has the original values echoed out as well as the resulting shorter integers, which I don't want (see picture). http://imageshack.us/photo/my-images/405/problemsh.jpg Code here, not all code, but the one in question and all surrounding tags: ' <td class="dataTableContent" align="right" valign="top">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . $num = $order->products[$i]["qty"]; if(intval($num) == $num){ $num = intval($num); } echo '<td class="dataTableContent" valign="top" align="right">'.$num.'</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n"; Cheers,
  4. Unfortunately when I posted the previous message I found how to do it, so simple and I had a lapse.. you beat me to replying!!!! lol. Thanks again
  5. Thanks for that. I've looked into putting this into what I have, a downloaded shop system (OSCommerce) and can't find a way to do so. The part where I want the statement to validate is as follows: <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . '</td>' . "\n" .
  6. Hello all, I have a database which stores values as decimal and then a page which displays the info. I would like when it is a whole number (say 1.00, 2.00, 3.00 etc) to display without the decimals (1, 2, 3 etc) while leaving other numbers as is (1.5, 2.25, 3.08 etc). Cheers in advance!
  7. Hello all, Back again with yet another problem. I've got and upload to directory form and also an unlink form function all well and fine. However, on the viewing side I'm wanting the images uploaded using said forms to be displayed in their thumbnail form (eg- 1thumb.jpg) and then link to a larger version in their normal image size (eg- 1.jpg). So far I have the following code mustered up which displays the thumbnail. However, my query is how to link to the actual image it is for (so 1thumb.jpg links to 1.jpg, 2thumb.jpg links to 2.jpg, 3thumb.png leads to 3.png etc etc). Code: $directory = "portimg/"; $images = glob("" . $directory . "{*.jpg,*.gif,*.png}", GLOB_BRACE); $thumbs = glob("" . $directory . "{*thumb.jpg,*thumb.gif,*thumb.png}", GLOB_BRACE); //print each file name if (is_array($thumbs)) { foreach($thumbs as $thumb) { echo "<a href='" . $image . "'><img src='" . $thumb . "' /></a>"; } } else { echo "<p>No files present</p>"; } ?> Many thanks!!
  8. Brilliant! Many thanks for the help both of you
  9. In the previous page I have pulled the information from the database (id and imgurl) for use in this process. The above code uses the id number as choice and removes where they match. Could I just have the unlink as follows: $imgurl = $_POST[imgurl]; unlink($url); Cheers.
  10. Hello, I'm wanting to create a script which deletes an image from both a database and off the directory. I understand that the code needed to remove from the directory is UNLINK, I'm having trouble finding how to put it into my code. As follows: <?php $conn = mysql_pconnect("#####", "###", "####"); mysql_select_db("###", $conn); $choice = $_POST[choice]; mysql_query("DELETE FROM ## WHERE id='$choice'"); echo "<p>Image has been deleted.</p>"; echo "<p>Click <a href='adminphotos.php'>here</a> to delete another.</p>"; ?> So our user has selected with a radio button which image they would like to delete and this page processes that. At the moment the above code removes from the database. Thanks in advance!
  11. Nevermind! I've got it working! Thanks all anyway!
  12. FAO thara: Changed that but it's still not working FAO Pikachu2000: The webpage displays as normal but the YouTube embedded player (and thus video) don't show at all.
  13. Hello all, Using a database backend and the WHILE function I'm wanting all YouTube videos entered in said database to show up in one loop. Simples. However, coded it's deciding that it does not want to play ball. Code: <?php // Start the connection to the database $conn = mysql_pconnect("****", "******", "*****"); // Select the database to use mysql_select_db("*****", $conn); // Create the MySQL command to retrieve all records $sql = "SELECT * FROM videos"; $result = mysql_query($sql, $conn); while ($array = mysql_fetch_array($result)) { $title = $array[title]; $hlink = $array[hlink]; $desc = $array[description]; echo "<h2>$title</h2>"; echo "<iframe width='560' height='315' src='$hlink' frameborder='0' allowfullscreen></iframe>"; echo "<p>$desc</p><hr />"; } ?> The YouTube embed is in an echo line with the link to the video (eg: 'http://www.youtube.com/*****') in variable '$hlink'. I've tried \" instead of single quotes and it still isn't working. Hopefully someone can help. Thanks in advance
  14. Using the bog standard 'SELECT * FROM table' but it isn't selecting the first record in the database. Could someone show me where I'm going wrong? CODE: $conn = mysql_pconnect("****", "****", "****"); mysql_select_db("****", $conn); $sql = "SELECT * FROM testemonials"; $result = mysql_query($sql, $conn); $array = mysql_fetch_array($result); while ($array = mysql_fetch_array($result)) { $id = $array[id]; $quote = $array[quote]; $person = $array[person]; echo "<p><input name=choice type=radio value=$id /><br />$quote - $person</p>"; } Thanks all in advance!
  15. Worked it out! Simpler than I thought.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.