Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. Hah sorry, yeah look into "window.open()" ..
  2. Unless the functions print straight to the page, you made need to echo out the return value of "con()" .. Also don't forget you've got qutoes in there which will trigger an error: $db_text = "blah blah <?php echo con(\"123\"); ?> blah"; Adam
  3. Give chmod a go... http://uk.php.net/chmod
  4. To be honest if you're new to javascript this will be a tough learning experience, but I once found this helpful for blending / fading objects in and out .. http://brainerror.net/scripts/javascript/blendtrans/ Adam
  5. ahh okay, it might be trying to divide by a string - try converting it to a float (not 100% sure this would work): if ($total == '' || $total == null || $total == 0) { $total = $total + $row['cost']; } else { $vat = (float) $row['float']; $total = $total + ($row['cost'] + ($row['cost'] / $vat)); } Oh also make sure there's no % on the front of it either!
  6. Oh wait sorry, missed the 'error in bottom left corner' bit.. Errmm only thing that looks a little out of place is: "void(0);" .. try removing that?
  7. Try putting it into a function within <script type="text/javascript"></script> tags .. When you use inline js like that sometimes browsers may see it as malicious code.. By the way this is the PHP forum.. Adam
  8. What data type is set for the vat field in your database?
  9. ??? if ($total == '' || $total == null || $total == 0) { $total = $total + $row['cost']; } else { $total = $total + ($row['cost'] + ($row['cost'] / $row['vat'])); } try that?
  10. Well technically it's a statement and should be written: include 'your_file.php';
  11. Also remember you still need PHP tags around the code within your external file...
  12. I've just editted it cause i made a mistake so make sure you use latest one..
  13. Ahh yeah replace the $total calculation line with: $total = ($row['vat'] != null) ? $total + ($row['cost'] + ($row['cost'] / $row['vat'])) : $total + $row['cost']; Not tested but should work! Adam
  14. Hah oh yeah! put it down to negligence..
  15. Do it in your PHP, not within the query. So when you loop through the rows, keep a variable, say $total and add to that with each loop. Something like: while ($row = mysql_fetch_assoc($query)) { // print out your table and stuff .. $total = $total + ($row['cost'] + ($row['cost'] / $row['vat'])); } echo 'TOTAL: ' . $total;
  16. for ($i = 0; $i <= 200; $i++) { echo rand(10000, 99999) . '<br />'; } Would print 200 unique 5 digit numbers..
  17. function submitForm(formName){ document.forms[formName].submit(); } replace your function with that..
  18. To cater for those without JS you could use: <script type="text/javascript" language="javascript"> window.close(); </script> <noscript>You may now close this page.</noscript>
  19. You'd probably need to use a timed event using javascript's setInteval() function. Then you could setup your own JS function to check if there are any new messages sent from clients, and obviouslly if so display a new popup window. For something like this you'll need to look into 'AJAX' as JS alone cannot run any scripts from the server; which you'll need to do to check for new chats, send / receive messages, etc. I'd suggest reading a few tutorials so you understand how AJAX works and what it can do for your web applications - then I think you'll have a much better idea of what you need to do... http://www.google.co.uk/search?q=ajax+tutorial Adam
  20. Yeah I was going to say more than anything a company will want proof of pexerience over qualification - but obviouslly you'll want some qualification there..
  21. Okay so in the topics table, how are you linking the topic to the user; by 'user id', 'username'? And where excactly are you wanting to link to the user's profile, on all the posts each user makes? Perhaps a screenshot or quick image of what you're trying to achieve might help cause I'm struggling to picture what you're trying to do... Adam
  22. Quite a few ways to do it I dare say, and probs one being a regular expression but I'm not very good with them.. Though I do have a few ideas: $emailArr = explode('@', $email); if ($emailArr[1] == 'aol.com') { // register user } OR: $pos = strpos($email, '@'); $domain = substr($email, $pos); if ($domain == '@aol.com') { // register user } You should be able to condense that a bit to: $domain = substr($email, strpos($email, '@')); Provided you've validated it as a valid email, because it returns false if there' no occurence, which obviouslly could cause an error in substr().. Adam
  23. Would be best off saving the date as "date" type (YYYY-MM-DD) in your database - I'm assuming it's MySQL? then, assuming you've queried the database and have the date stored in $row['run_date'] .. you could simply go.. if ($row['run_date'] == date("Y-m-d")) { // do something! } Adam
  24. $ip = $_SERVER['REMOTE_ADDR'];
  25. I think he wants to return a full page, not just a string of text? Like Blade said earlier, look into AJAX and how you can make HTTP requests, a good example of what we're talking about is .. http://www.w3schools.com/Ajax/tryit.asp?filename=tryajax_httprequest_js1 But I'd have a good read through a tutorial first before trying to make your own.. If you were to setup your own javascript function which used AJAX to return a page, you could simply have the links set to something like: <a href="javascript:loadPage('mypage.php');">My Page</a> and a quick tip for you, because not every user has JS, you'd be best using: <a href="mypagefull.php" onclick="loadPage('mypage.php'); return false;">My Page</a> Which in the circumstance that the function fails to return the page, or the user has JS disabled, will just redirect them to the actual page and avoid any loss of function.. Post was a bit rushed cause I'm about to leave work Adam
×
×
  • 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.