Jump to content

davidannis

Members
  • Posts

    627
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davidannis

  1. file2.php will not execute until file1.php is done executing. You could probably spin off a background process in file1, but then getting the output back and echoing it would be hard. This may help point you in the right direction: http://braincrafted.com/php-background-processes/
  2. I believe that you want to look at $_SERVER['HTTP_USER_AGENT'] and decide if it is a mobile browser and then return a different url if it is: http://php.net/manual/en/reserved.variables.server.php I believe that if you are willing to depart from just using php you can use jQuery to deliver a version of the site optimized for mobile but that is beyond my pay grade and belongs in the javascript section of the forums.
  3. You are right. The space is is ignored and multiple spaces after the colon should work too (according to the RFC). I thought I had an issue a few moths ago that I solved by adding a space after the colon in a header, but I must be remembering it incorrectly. I stand corrected. Sorry.
  4. The textbook answer is to normalize things. A table for garment type, a table for colors, a table for design. In practice, if I didn't expect the colors to change I would would combine garment type and color into a single table. table: garment fields: garment type, color, price table: design fields: number of colors, company, quantity, price I don't understand when you would use company 2, since it looks more expensive in all cases. If you want the textbook answer separate the first table into 3: table: garment_price fields: garment_type_code, color_code, price table: garment fields: garment_type_code, garment_description table: color fields color_code, color_description
  5. Good catch Mac-gyver. The record is never fetched. I bet the OP is looking for something like $row['user_level'] from the database row that never got fetched.
  6. and you still should have a space after Location: header("Location:Admin_home.php"); header("Location:home.php"); but you don't need the space in else if you can use elseif
  7. also your mail() function is wrong. You need to separate the to, subject, and body with commas. To change the from, you need to use headers as a fourth parameter
  8. Not sure what this is doing wrong but... A few suggestions: You need a space after Location: in the header() Use mysqli instead of mysql sanitize your data to prevent SQL injection attacks $password=mysqli_real_escpe_string($con, $_POST['password']) salt and hash your passwords so they are not stored in the clear. when posting here put code in code tags (the <> symbol in the editor)
  9. try adding name="submit" to the submit button or check like this: if (isset($_POST['myusername']) || isset($_POST['mypassword']))
  10. Another couple of suggestions unrelated to your question: use the code tags around code you post in the forum (the <> symbol in the editor) in SQL use all CAPS for the reserved words like UPDATE, SET, WHERE (makes things easier to read) given a choice use mysqli instead of mysql
  11. I would check the following: see what the getStatus function is returning. Make sure it is returning the expected value. You should see it in the URL that header sends you to. echo the $qry and try to run the SQL directly against the database (use phpMyadmin perhaps) and see if it executes correctly.
  12. This looks suspiciously like a homework assignment. I can't see a real life application for these scripts.
  13. You can easily pass DepartmentQ through the second form as a hidden field. <input type="hidden" name="dept" value="departmentQ"> then if (second page was submitted test here){ write to database } if (isset($_POST['dept']){ //do your query here and redisplay the list of people in Department Q here }
  14. Yes, you do not need to store anything in cookies unless you want a user's login to last after they have closed their browser.
  15. A couple of things. You need to do session_start(); at the top of your program. Then, set session variables as $_SESSION['myvar']=$myvar ; Don't store the password in a session variable, just the fact that the user successfully logged in.
  16. to return multiple values use an array.
  17. Not sure why you are off an hour. Is the clock on the server right? You can not have two return statements like that. The second will never execute.
  18. One problem is that A valid variable name starts with a letter or underscore and $1stprizepic starts with a number. http://www.php.net/manual/en/language.variables.basics.php
  19. I don't know, but in your shoes I'd try first setting the url on the refresh to a full domain name and path or if that doesn't work refresh with a ?dummy=done
  20. When you do this: }else{ $referrer = $no_referrer; you set the variable equal to an empty variable unless there is code we're not shown. Did you mean to do this: }else{ $referrer = 'no_referrer';
  21. no ; before line 256 after session_start
  22. To catch the NOT at the start of the string and require a space in front of it using substr try this: <?php $mystring = ' abcNOT def'; $findme = ' NOT '; if (substr($mystring, 0, 4)=='NOT '){ $new="-".substr($mystring, 4); }else{ $new=str_replace($findme, ' -', $mystring); } echo $new; ?>
  23. looking at ignace's version compared to mine I see I did not require either a space before the not or that the not be at the start of the string. Mine is case sensitive. Hers is not.
  24. try something like this: <?php $mystring = 'abcd NOT def'; $findme = 'NOT '; $new=str_replace($findme, '-', $mystring); echo $new; ?>
×
×
  • 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.