Jump to content

Andy-H

Members
  • Posts

    2,000
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Andy-H

  1. $result = mysql_query("SELECT full_price, half_price FROM eu_place WHERE city = '" . mysql_real_escape_string($subcat) . "'") or die(mysql_error()); $row = mysql_fetch_row($result); if ($load == 'full_load') { echo (" "). number_format($row[0], 2); } else { echo (" "). number_format($row[1], 2); } $resultPickup = mysql_query("SELECT price FROM uk_place WHERE city = '" . mysql_real_escape_string($pickup) . "'") or die(mysql_error()); $rowPickup = mysql_fetch_row($resultPickup); echo "£" . round( ($rowPickup[0] + $row[0]), 2); ???
  2. echo round( ($rowPickup['price'] + $row['full_price']), 2);
  3. yeh
  4. It makes your db connection variable scope global, therefor you don't need to connect to your database in the function.
  5. Try that? Duno if it will work...
  6. <script type="text/javascript"> parent.frameName.location.reload(true); </script>
  7. Should work if you just change the field to varchar, the dates will all bew in the wrong format now tho and would need the -'s added.
  8. That script is seriously f****d up....
  9. $rating = $_POST[{$row['StudentID']}];
  10. lol yup that would be easier, duno if he neccessarily wanted to keep the same keys tho maybe $tmp_array[] = $array[$i] Would be better
  11. The = echo only works with short tags, try using <?php echo $_SESSION['translator']->out('WELCOME'); ?> Also I think the session is empty, do you have the session_start(); anywhere on the page or any included pages? <?php session_start(); if ( empty($_SESSION['translator']) ){ echo "Session empty."; } ?>
  12. $str = ""; for ($i = 0; $i < count($file); $i++){ if ( strlen($file[$i]) > 0 ){ $str .= "-" . $file[$i]; } } $str = substr($str, 1); $file = implode("-", $str); Does that get the desired result?
  13. lol how does that work out?
  14. Also in an array with that many values I wouldn't run the count() function inside the loop. Assign the number to a variable first then use the variable in the loop, should be a little faster.
  15. $p = htmlentities($_GET['p'], ENT_QUOTES); $id = htmlentities($_GET['id'], ENT_QUOTES); require_once "../" . $p . "/" . $id; I think ??? Would need protection from external files too.
  16. Andy-H

    Error

    function validateReceiptNumber($val) { global $continueSubmit ; $conn = mysql_connect("localhost", "root", ""); mysql_select_db("emobase2"); $check = "select `Receipt Number` from members where `Receipt Number` = '$val';"; $qry = mysql_query($check, $conn) or die (mysql_error()); $num_rows = mysql_num_rows($qry); >>> echo $num_rows; <<< if ($num_rows != 0) { $continueSubmit = false; echo "Sorry, the Receipt Number is already available.<br>"; }else{ echo "Thank You";} }
  17. $n = 1800; $q = "SELECT stocks_used FROM table"; $r = mysql_query($q); $row = mysql_fetch_row($r); $arr = explode("-", $row[0]); for ($i = 0; $i < $n; $i++): $rand = rand(0,1800); if (!in_array($rand, $arr)): $arr[] = $rand; Endif; //Display stocks here Endfor; $new = implode("-", $arr); mysql_query("UPDATE table SET stocks_used = '$new' LIMIT 1"); /// stocks_used would be like 142-432-653-etc... Duno if you get the idea but I think that would work.
  18. Lol I know what you mean, I always overthink things.
  19. $data = explode("</p>", $content); echo $data[0] . '</p>'; ??
  20. if ( in_array("101", $row_articleBannersRS) ){ include('inc_banner1.php'); } if ( in_array("102", $row_articleBannersRS) ){ include('inc_banner2.php'); } if ( in_array("103", $row_articleBannersRS) ){ include('inc_banner3.php'); } Would that work?
  21. code too long...
×
×
  • 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.