Jump to content

kessels1234

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by kessels1234

  1. Hi, First let's say I'm a beginner in php . The way you do it now : Assume that a password == mysecretpassword You ask the database if mysecretpassword exists with a given username. Ofcourse this doesn't exist because the first time (when registered on the website or application) you converted the given password to a MD5 and that's what's in the database Something like:h35dfg78766df5f7d8d8f6 So when you want to compare this you have to convert the given password again to md5 $password = $_POST['password']; Should be something like this : $password = md5($_POST['password']); Hope it helps Danny
  2. The reason I want a real unique number is that I think that it is nobodies business to see(count) how much business we're doing on the repairs. We do repairs for customers on a regular basis. So one customer can come back 2 or 3 times within a month. If you have a simple increment by 1 a customer can see how much repairs we had since his last visit. This is not a welcome situation and that's the reason why I need a unique number. Hope this clears the questions and if anyone has some good alternatives I'd love to hear them. Thanks, Danny
  3. Thanks for all the help. inversesoft123: I (partially) see what you mean but I don't know how to implement this (further)(still newbee who's learning) Solution I came up for now =: $maxsql = "SELECT MAX(repair_id) FROM repair"; $maxresult = mysql_query($maxsql); $maxrow = mysql_fetch_assoc($maxresult); $max_id = $maxrow['MAX(repair_id)']; Get the latest repair_id in the database and $order_num = date("Ymds"); $order_num .= $max_id; to create the ordernumber and then store it in the database with all the rest of the formdetails. Love to have comment on this. Thanks Danny
  4. Hi, Does anyone know a good way to create a good ordernumber. I have a table with a record: order_num I want it to be a reasonable number. I know I could do something like this: $order_num .= date("Ymdhis"); But this returns a much too long number. I guess what I want is something like this: year+month+day+number number should be incremented by, let's say 5 Example ordernumber should look like this: 2010030115 and the next ordernumber should be 2010030120 so in the database there shoul be a lookup on the last ordernumber. Any ideas? Hope this story makes sense. Thanks in advance Danny
  5. Thanks for the reply. I guess it is just a matter of opinion than. About safer feelings: The main goal is to delete all records related to the customer and that is what this does. Multiple ways lead to Rome........ SOLVED
  6. Hi, thanks for your help. I got it working and the final sql statement = $repairsql = "DELETE klanten, repair FROM klanten LEFT JOIN repair ON klanten.klant_id=repair.klant_id WHERE klanten.klant_id = ".$validid.";"; jl5501:Why wouldn't it be a good idea to do it this way? Thanks again everyone
  7. Hi, I want to perform a delete on multiple records from different tables. I have a table called KLANTEN(=customers) and I have a table called REPAIR: A customer can have more than 1 repairs. So when I delete a customer, also all repairs should be deleted to. My tables: 1. KLANTEN klant_id title firstname lastname etc....... 2. REPAIR repair_id klant_id instrument etc..... I though that following sql statement would do the job but obvious it doesn't case "klant": $repairsql = "DELETE FROM klant LEFT JOIN repair ON klant.klant_id=repair.klant_id WHERE klant_id = ".$validid.";"; mysql_query($repairsql); if (!$repairsql){ echo "Gegevens niet verwijderd"; } else{ header("Location: ".$livesite. "/admin/klant_list.php"); } break; I get the $validid through the url via a $_GET What am I doing wrong? Thanks for your help in advance. Danny
  8. Thankx, I'm gonna check it out Danny
  9. Don't really get what you mean by this. If you have some example code to demonstrate what you mean I can try to figure out. Thanks again for your help, Danny
  10. OK found it. The header refresh was inside a function and I think that must have been the problem. I replaced it and now it works Thanks for the help Danny
  11. The variable $validid is coming from a $_GET if (isset($_GET['klant_id']) == TRUE) { if (is_numeric($_GET['klant_id']) == FALSE) { $error = 1; } if ($error == 1) { header("Location: ".$config_basedir); } else { $validid = $_GET['klant_id']; } } This can't be the problem because where ever I echo out this $validid on the page it gives me the right result
  12. Hi Wildteen88 I tries that but that doesn't work header("Refresh: 1; URL=klant_actions.php?klant_id=$validid"); that gives me in the url: klant_actions.php?klant_id= Any other suggestions?
  13. Hi, Hope someone can help: I want to use the header refresh with a dynamic url. What I want is to redirect to klant_actions.php?klant_id=$validid The problem is with the $validid. It doesn't show up in the url. It is probably a formating problem but I can't seem to solve it by myself. I tried this: $returnurl = "klant_action.php?klant_id=$validid"; and then something like this: header('Refresh: 1; URL='.$returnurl); When I echo the $returnurl it gives me the correct url header('Refresh: 1; URL=klant_actions?klant_id=$validid'); this gives me an empty value in the url Any ideas? Thanks in advance Danny
  14. Hi zanus, I'm trying to figure out what your code does. As soon as the for loop comes it gives me a blank screen (no errors). for($i = 0; $testdata = mysql_fetch_assoc($testresult); $i++) { if($testdata['m'] == "January") echo ($i>0) ? "</tr><tr>$monthsTR</tr><tr>\n" : "<tr>$monthsTR</tr><tr>\n"; echo "<td>$testdata['total']</td>"; } this code: if($testdata['m'] == "January") is ofcourse wrong because Januari doesn't exist. Whatever I try to do to correct this, it keeps giving a blank screen. Thanks for taking the time to help me with this. Really appreciate it.
  15. Any idea of an example on how the sql and the code should look like?
  16. Hi Fenway, Don't know exactly what you mean/ or how to accomplish but what I really need is all those values separate(month-total by year) so I can write them eventualy to an xml file so I can use charts to visualize the selected statistics. I know that this is maybe too difficult for a newbee but I want to learn and already finnished my application so far that everyone that uses it is very happy. Maybe I need a different approach with the given records in the database and use a different sql statement? Thanks, Danny
  17. Ok next problem with this: How can I make an output like this (e.g. $start = 2007 $end = 2010 with the possibility that there are months with no sales (=zero)): 2007 Jan Feb Mar Apr Jun Jul Aug Sept Okt Nov Dec 0 0 1500 2000 1100 1200 800 999 650 799 899 2008 Jan Feb Mar Apr Jun Jul Aug Sept Okt Nov Dec 0 0 1500 2000 1100 1200 800 999 650 799 899 2009 Jan Feb Mar Apr Jun Jul Aug Sept Okt Nov Dec 0 0 1500 2000 1100 1200 800 999 650 799 899 2010 Jan Feb Mar Apr Jun Jul Aug Sept Okt Nov Dec 5000 2500 0 0 0 0 0 0 0 0 0 To get all the data I'm using this sql: $testsql = "SELECT SUM(bedrag) as total, EXTRACT(YEAR FROM date) as y, EXTRACT(MONTH FROM date) as m FROM provisie WHERE werknemer_id = $validid AND YEAR(date) BETWEEN '$start' AND '$end' GROUP BY y,m"; Months are given in numbers but they need the names as shown in my example. To accomplish this my guess is to do it with 'for loops' but I cant figure out how I can do this. Hope you can help me Thanks in advance Danny
  18. Hi PFMaBiSmAd, Thanks for your answer, I think this will help me but i have to test some things to get it just the way I want. Maybe I have to get back to. Thanks again Danny
  19. Hi, I'm new here and this is my first post. I'm having a little problem with my script and hope someone can help. I have the following table: PROVISIE with the following records: provisie_id werknemer_id date klant_naam fact_nr opmerking bedrag I have a selectlist to select (a period of time)year1 and year2. Between these years I like to know for every month how much sales (bedrag) are being made by the specific employee (werknemer_id) for now i can do it static for a specific month with the next query which works well: $testsql = "SELECT SUM(bedrag) FROM provisie WHERE werknemer_id = ".$validid." AND MONTH(date)=1"; $testresult = mysql_query($testsql); while($customrows = mysql_fetch_assoc($testresult)) { echo $customrows['SUM(bedrag)']; } So what I want. The employee selects year 1 and year 2. Let's say 2009 and 2010. The script should then give the next output: Jan (total amount of all sales in January 2008) Feb (total amount of all sales in January 2008) March (total amount of all sales in January 2008) April (total amount of all sales in January 2008) ..... ..... ..... Dec (total amount of all sales in January 2008) I hope I made clear what my question is. any suggestions welcome. Danny PS date is also date in mysql
×
×
  • 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.