Jump to content

shino

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by shino

  1. Try instead: $postcodearray[$n] = $postcode;
  2. Like this? $string = implode(':', $arr2); echo $string;
  3. The closest I was able to get was to ask them to print and they click yes and it prints, but that was via adobe livecycle pdf. I know there are scripts and codes but it requires other things, which I wasn't sure to understand. Here this is where I saw the discussion: http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=12622
  4. Try this in another php file on it's own and send it a ?id=1000 or something in the url: <?php echo $_GET['id'].'<br />'; echo $id.'<br />'; ?> It should only echo once, if you see it twice then register globals is on and you need to disable it with your host.
  5. would be easier if you posted your whole code. Also, could be if your using $do somewhere and register globals is on that it's overwriting it.
  6. Maybe something like: <?php $query='select * from table where id='.(is_numeric($id) ? $id:'"" OR 1=1'); ?>
  7. You can use array_keys(); http://php.net/manual/en/function.array-keys.php $keys = implode(',',array_keys($data));
  8. You could do <?php extract(getTrophy($id, 'Posts', 'account')); ?>
  9. In your while it should be $result in the function and not $sql. Have you tried this?
  10. Based on my previous response, here is what i've added. You just add an INNER JOIN with your current_employees table, inner join basically returns a result when the table your joining it with matches so the ones that aren't in current_employees won't show up. <?php $query = "SELECT employees.* FROM employees INNER JOIN current_employees ON (employees.idnum = current_employees.idnum) LEFT JOIN shifts ON (employees.idnum = shifts.idnum) WHERE shifts.intime > shifts.outtime AND (SELECT COUNT(id) FROM projects WHERE idnum = shifts.idnum AND projStatus = 'Open' ORDER BY id DESC LIMIT 1) = 0"; $who = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($who)){ echo $row['MAX(fname)']. " - ".$row['lname']; echo "<br />"; } ?>
  11. Have you tried md5 without the crypt? An easy way would be to pick a password say: test, do md5('test'); then compare that result with the one from your code in your login sequence and see if it's identical, that way you can spot your problem.
  12. You could try maybe: <?php $url = "http://www.google.com/images?hl=en&source=imghp&q=whales&gbv=2&aq=f&aqi=g10&aql=&oq=&gs_rfai="; $str = file_get_contents($url); preg_match_all('/"http:\/\/t[0-9]\.gstatic.com\/images([^"]+)"/',$str,$matches); foreach( $matches[0] as $match ){ echo trim($match,'"').'<br />'; } ?>
  13. I would personally use is_file() instead of file_exists()
  14. You could try something like: $query = "SELECT employees.* FROM employees LEFT JOIN shifts ON (employees.idnum = shifts.idnum) WHERE shifts.intime > shifts.outtime AND (SELECT COUNT(id) FROM projects WHERE idnum = shifts.idnum AND projStatus = 'Open' ORDER BY id DESC LIMIT 1) = 0"; $who = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($who)){ echo $row['MAX(fname)']. " - ".$row['lname']; echo "<br />"; } That's if you have an id auto increment column in your projects table
  15. Thanks for your replies, now I just need to know what you guys think about handling errors like this. Have any of you done so, do you find it works well and makes the handling of errors more friendly to the users whom might experience them, what are your thoughts on this? You might take this in context versus a notice or warning appearing on very top of your browser page, or crashing the program itself with a blank page and some wierd error, etc.
  16. Yes exactly, and being able to output that where and when an error occurs anywhere on the page. Don't know if that's a good method of handling errors, if there is a preferable one, or any input, ideas or opinions on doing it this way. It would be nice if something like this would work <?php if (!empty($errors)) { echo $errors; } // this function will fail with an error // but the error would be outputted above. call_some_function(); ?>
  17. No that I understand about validation, that is no problem at all. It's more like this. <?php function login($username, $password) { // do login check but for some reason who knows what it could be its possible something fails and not the validation but more the function calls or w/e // then error or crash throw new Exception('Something happened and it crashed!'); } if ($_SERVER['REQUIRED_METHOD'] == 'POST') { $username = trim($_POST['username']); $password = trim($_POST['password']); if (!empty($username) && !empty($password)) { try { // do login check $check_login = login($username, $password); } catch (Exception $e) { $errors = $e->getMessage(); } } } ?> <html> <head></head> <body> SOME HEADINGS OR TEXT HERE <?php if (!empty($errors)) { echo $errors; } ?> FORM GOES HERE </body> </html> What I basically want to achieve is something similar to what I quickly wrote above, it might not be ideal but it's something like that that I want to be able to produce. Basically any error which could happen for whatever reason, be outputted in the html content so that it can appear friendly to the user but can at least warn them something happened and if by any chance they would have filled info on their forms or w/e we could still salvage it so they can at least maybe save their info without having to retype it or i don't know but it's what Im hoping to achieve without having a blank page with errors or errors outputted before html, etc. I'm just looking for your professional opinions or tips on handling errors like these, not just exceptions. Validation is ok, it's more like other errors that would make the functions fail or etc. Sorry if im still not clear, Im not good at explaining... lol
  18. Hi what I am trying to accomplish is this: Say you are a user and you are presented a webpage with a nice layout and a form to fill in, and you fill out the information and miss some required fields, what i would do then is validate the input and present an error msg besides each required field. That is fine for me. Second is if something breaks within my code due to whatever reason, instead of outputting an error outside of the html and causing the layout to break I would prefer to be able to output a nice error msg within the website's layout surrounded by whatever CSS I would put. Third, if a serious fatal error would occur, instead of just stopping the script I would probably create a specific error page which would have the website's layout but contain a specific error so it would be both presentable to the user seeing the error and contain the information I would need. My question is this, how would you or anyone if you guys have better understanding of handling errors and exceptions, achieve this? I mean for the error handling part (Excluding exceptions), most examples I come accross the internet, just show notices and warnings like the usual php errors, but what I want is to be able to take that error, maybe store it in a variable and output it anywhere I want on a webpage so that way I can truly customize the look when an error occurs and not simply just break the whole website's design because an error occured. Sorry if im not being clear enough. Any opinions or advice is welcome!
×
×
  • 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.