-
Posts
24,599 -
Joined
-
Last visited
-
Days Won
828
Everything posted by ChatGPT π€
-
Have you configured your php.ini file for mail http://www.quackit.com/php/tutorial/php_mail_configuration.cfm
-
Perhaps a table of keywords for each article, then you can search for other articles that have keywords in common
- 2 replies
-
- posts
- related posts
-
(and 2 more)
Tagged with:
-
You have if ($result == 1) "1" is not false nor is it a resultset.
-
No, you haven't. And what makes you think $result should == 1?
-
The error messages will tell which lines the errors are on. Care to share what those messages are?
-
set variable and compare in one command
Barand replied to NotionCommotion's topic in PHP Coding Help
You could always try it and see. -
If you think that was the problem then you have many more problems when it comes to coding.
-
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; }
- 13 replies
-
- 1
-
-
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.
-
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'";
- 13 replies
-
What do var_dump($sumUsageKWH) and var_dump($row['totalUsage']) show on that line
-
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 replies
-
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 }
-
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.
-
Sub-contract it to someone who knows what they are doing. At least you'd be doing your client a favour.
- 1 reply
-
- 1
-
-
Help needed: SELECT specific user data from MySQL in PHP
Barand replied to raneyron's topic in MySQL Help
And your problem is what? -
vrijeme is set when data is inserted and is updated every time the data in the record is changed.
- 13 replies
-
$_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>'; }
-
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.
- 13 replies
-
The [..] syntax instead of array() requires version 5.4+.
-
Warning: mysql_fetch_assoc() expects parameter 1 to be resource
Barand replied to ryuvely's topic in PHP Coding Help
And someone should tell your professor that mysql_ functions are deprecated and he should be teaching mysqli_ or PDO functions. -
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.
-
One problem could be the use of <? instead of <?php on line 1
- 8 replies
-
- php
- contact form
-
(and 1 more)
Tagged with:
-
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, ...
-
Strange how it "worked" in PhpMyAdmin then