Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. Use mysql_error() to find the error returned. Generally this will help you solve the problem straight away.
  2. Sorted it. The problem was the sequence select; moved it before the merge and all the errors disappeared. Thanks for your advice! I've not quite finished the job yet but I think I'll be able to work out the rest on my own now, thanks again! Adam
  3. Thanks a lot for the reply. I've been trying to use the merge statement but having a few troubles. This is the code I have so far: merge into merchandise_items mi using dual on (mi.item_id = pItemId) when matched then update set ... when not matched then select merchandise_container_seq.nextval into vItemId from dual; insert ( ... ) values ( ... ); I'm not exactly sure what the problem is, but all the field names, though left out where not essential, are correct and so shouldn't be causing the problem. In SQL developer I'm getting the following errors: Error(1166,5): PL/SQL: SQL Statement ignored > Refers to: "merge into merchandise_items mi" Error(1184,9): PL/SQL: ORA-00905: missing keyword > Refers to: "select merchandise_container_seq.nextval into vItemId from dual;" Error(1185,9): PL/SQL: SQL Statement ignored > Refers to: "insert" Error(1186,9): PL/SQL: ORA-00925: missing INTO keyword > Refers to: "(" - just underneath "insert" I'd be very grateful if you, or anyone else, could take another quick look and see if you can spot what the error is? Thanks again for your help, Adam
  4. It's okay, but a little basic... Quick look on Google and I found: http://bmearns.net/wwk/view/Insert_text_into_textarea_with_Javascript
  5. Although the script may work, it isn't exactly secure. Consider that cookies can be added / modified so easily, just testing if the cookie has been set isn't secure enough, because they can just add it. There's also the chance of cookie stealing scripts obtaining your login info; you'd be better off using PHP sessions.
  6. Try this: header("Location: mailto:" . $_GET['u'] . "@" . $_GET['d'] . "." . $_GET['s']);
  7. Realise this is closed now but, you could improve that further: if (strlen($str) == 5) { $pattern = '/([0-9]|1[0-2])(0[0-9]|[1-5][0-9])(am|pm)/'; } elseif (strlen($str) == 6) { $pattern = '/(1[0-2])(0[0-9]|[1-5][0-9])(am|pm)/'; } preg_match($pattern, $str, $matches);
  8. Ah, I jumped to the conclusion your ID field was integer.
  9. Was there an error? Edit: Didn't see you had modified post.
  10. I don't understand the great need for shorthand workarounds? The odd second or two you may save yourself here n there in future won't count for anything against the many hours you spend looking them up and learning them. Just pick them up naturally whilst learning more useful things... I suppose a good analogy is moving to a new town and trying to find someplace by taking every short cut you find, without going down the main roads a few times first? Ha.. second thoughts perhaps a little corny!
  11. <?php $foo = isset($_GET['string']) ? $_GET['string'] : null; if(!is_null($foo)) { echo <<<EOD <table width="1000000"> <tr> <td>You could fit a big table in here!</td> </tr> </table> EOD; } else { echo <<<EOD <span class="whenever">'single quotes as well'</span> EOD; }
  12. This isn't actually AJAX, but, basically you need to append the element as a child, or insert it before another element. There's most likely more ways I just can't think of any off of the top of my head. Have a read through a few of the links found on Google for a better idea: http://www.google.co.uk/search?q=dynamically+create+element
  13. Using that exact code - except changing the action attribute to the same page - after I click submit the value disappears. What platform have you tested this on?
  14. Hey up guys, Working with some procedures in Oracle. I'm not brilliant with PL/SQL syntax yet so I'm a little stuck with this and lack the terminology to search for it properly on Google. What I'd like to do is run a select query that will hopefully return an `item_id`. If there is an item ID then I'd like to run an update, if not, an insert. My code looks like this: select item_id into vItemId from replaced_table where replace_field = pSitecode and replaced_field = pLang and replaced_field = pPageId and replaced_field = pGroupId and replaced_field = pRuleId and replaced_field = pTypeId and replaced_field = pSku; if vItemId <> null then ... else ... end if; However I'm getting a compile error in SQL developer with that, saying that the if statement is unreachable code? To be honest though I don't actually know how to test if the query returned a result, or to test if `vItemId` contains any data (and I'm not entirely sure what value it would have if there was no results returned - guessed null). Could anybody shed any light on this? NB. To be on the safe side of violating my contract I just replaced the table and field names. Thanks Adam
  15. What are the possible formats it could be? 24hour possible? leading zeros possible? etc. You certainly don't need all that... Perhaps something like: $str = '530pm'; preg_match('/(0?[0-9]|1[0-2])(0?[0-9]|[1-5][0-9])(am|pm)/i', $str, $matches); print_r($matches); Can make it more accurate once we know all the possible formats though...
  16. Neil's right. There are ways to make it difficult though, but you can never make it impossible.
  17. Well yeah it's possible, but what are you trying to do??
  18. Well, there's your problem? $count isn't being defined. You've posted code from the point where $count is used as well, so can't help you any further at the moment.
  19. If you're having problems importing large amounts of data through a web-interface, perhaps consider importing via the command-line - assuming you have access?
  20. You could do it like this: while($row = mysql_fetch_array($guests)) { $user_list .= '<span class="activenick">' . $row['alias_name'] . '</span>,'; } print rtrim($user_list, ',');
  21. How are you populating the array?
  22. Field values need quotes around them if they're strings: $q = "INSERT INTO info_table (add_info_check) VALUES ('{$_info_check}')";
  23. You mean something like... <?php $_product = $this->getProduct() ?> <?php if($_product->isSaleable()): ?> <p><img src="img/in_stock.gif" alt="In Stock" /></p> <?php else: ?> <p><img src="img/out_of_stock.gif" alt="Out of Stock" /></p> <?php endif; ?>
  24. I assume you mean with jQuery? In what event do you want the fadeOut to occur?
×
×
  • 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.