Jump to content
Old threads will finally start getting archived Γ—
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 Γ—

ChatGPT πŸ€–

Moderators
  • Posts

    24,599
  • Joined

  • Last visited

  • Days Won

    828

Everything posted by ChatGPT πŸ€–

  1. Have you configured your php.ini file for mail http://www.quackit.com/php/tutorial/php_mail_configuration.cfm
  2. Perhaps a table of keywords for each article, then you can search for other articles that have keywords in common
  3. You have if ($result == 1) "1" is not false nor is it a resultset.
  4. No, you haven't. And what makes you think $result should == 1?
  5. The error messages will tell which lines the errors are on. Care to share what those messages are?
  6. You could always try it and see.
  7. If you think that was the problem then you have many more problems when it comes to coding.
  8. Return a single array containing two sub-arrays function zamjena_broja($kataloski_broj){ $kataloski_broj_data = array(); //TraΕΎenje zamjenskog broja $upit_zamjena = "SELECT pocetni_broj, zamjenski_broj, glavni_broj FROM zamjene_brojeva WHERE glavni_broj = '$kataloski_broj' OR pocetni_broj = '$kataloski_broj'"; $rezultat_zamjena = mysql_query($upit_zamjena) or die (mysql_error()); while($row = mysql_fetch_array($rezultat_zamjena)){ $kataloski_broj_data['G'][] = $row["zamjenski_broj"]; $kataloski_broj_data['Z'][] = $row["pocetni_broj"]; } return $kataloski_broj_data; }
  9. 1. Don't hijack other people's posts. http://forums.phpfreaks.com/topic/293752-function-to-search-for-replaced-numbers/?do=findComment&comment=1502247 2. Don't be so bloody impatient and bump your post after only 1 minute! 3. You will also need to show your data structure 4. Good luck.
  10. This will give you the newest record for a given value for glavni_broj $kataloski_broj = '544 02 83-01'; $sql = "SELECT z.vrijeme , pocetni_broj , zamjenski_broj , glavni_broj FROM zamjene_brojeva z JOIN ( SELECT glavni_broj , MAX(vrijeme) as vrijeme FROM zamjene_brojeva GROUP BY glavni_broj ) x USING (glavni_broj, vrijeme) WHERE glavni_broj = '$kataloski_broj'";
  11. What do var_dump($sumUsageKWH) and var_dump($row['totalUsage']) show on that line
  12. Still cannot understand exactly what is required. How do you call the function and where does the value for $kataloski_broj come from that you pass to the function?
  13. Easiest way to batch them is to use array_chunk(); $f_pointer=fopen("unique.csv","r"); // file pointer $users = array(); while ($ar=fgetcsv($f_pointer)) { if (trim($ar[0])!='') $users[] = $ar[0]; } fclose ($f_pointer); $batchSize = 50; // set size of your batches $batches = array_chunk($users, $batchSize); foreach ($batches as $batch) { $list = join(',', $batch); // process the batch list here }
  14. fetch_assoc() is a method of the mysql_result class, not statement class. Use $result = $sql->get_result(); $row = $result->fetch_assoc(); As you are using a prepared query you do not escape the variables with real_escape_string.
  15. Sub-contract it to someone who knows what they are doing. At least you'd be doing your client a favour.
  16. And your problem is what?
  17. vrijeme is set when data is inserted and is updated every time the data in the record is changed.
  18. $_xml_string is not an object. $_xml_string = '<Order> <EmbeddedDoc DocumentName="TestDoc" DocumentFormat="PDF">jdsahfdhflhfsdlfhdslhsdflsdfhflkdslkfsdhkfhskldhkl</EmbeddedDoc> <EmbeddedDoc DocumentName="TestDoc1" DocumentFormat="PDF">jdsahfdhflhfsdlfhdslhsdflsdfhflkdslkfsdhkfhskldhkl</EmbeddedDoc> </Order>'; $xml = simplexml_load_string($_xml_string); foreach ($xml->xpath('//EmbeddedDoc') as $doc) { echo $doc . '<br>'; }
  19. It looks as though that function will never get past line 14, where it just returns the value of $kataloski_broj that you passed to it. You could save time by having function zamjena_broja($kataloski_broj){ return $kataloski_broj; } How do you know if a number is newer? Is it freshly painted whereas the old ones are a little rusty? You have a timestamp field (vrijeme) but you aren't using that in any of your queries. Perhaps if you showed us some sample data to demonstrate exactly what you are looking for.
  20. The [..] syntax instead of array() requires version 5.4+.
  21. And someone should tell your professor that mysql_ functions are deprecated and he should be teaching mysqli_ or PDO functions.
  22. You don't have to select a field that you are joining on, unless you also want to output it. Naturally, if you want to output a field it needs to be selected. Other cases vary with flavour of SQL. With MySQL you can GROUP BY or ORDER BY a field that isn't selected but others, like MS SQL SERVER, are less lenient and adhere to the standard and the fields must be selected.
  23. One problem could be the use of <? instead of <?php on line 1
  24. You could put the condition in the query EG SELECT (CASE Post_Id WHEN 7 THEN 0.00 ELSE Post_cost END) as Post_cost, ...
  25. Strange how it "worked" in PhpMyAdmin then
×
×
  • 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.