-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
Those errors are because your query failed. Check mysql_error() to find why.
-
Read what the error message is telling you then look at the code on that line. It says the MySQL link resource is invalid here: $query0 = mysql_query("SELECT username FROM Users WHERE mxitid=$mid", $con); So why is it invalid? Look here: $conn = mysql_connect('*****','*******','*******') or trigger_error("SQL", E_USER_ERROR); Not difficult.
-
SNAP!
- 3 replies
-
- filter_var
- filter_validate
-
(and 1 more)
Tagged with:
-
The array key should be "options" and not "option" $valYoB = array('options' => array('min_range' => 1900, 'max_range' => 2000));
- 3 replies
-
- filter_var
- filter_validate
-
(and 1 more)
Tagged with:
-
Unexpected $end usually means you have a "{" somewhere without a corresponding "}". You also have some php code amongst your HTML without surrounding <?php..?> tags
-
you could do something like this $sevenDaysAgo = (new DateTime('-7 days'))->format('Ymd'); foreach($xml->gms->g as $games) { $eid= substr($games['eid'], 0, ; // get date part if ($eid < $sevenDaysAgo) continue; // skip and process next if(!empty($games['vtn'])) . . . . . . }
-
or skip the array and use xpath. Try $xml = simplexml_load_string($xmlstring); foreach ($xml->xpath('//device') as $dev) { echo "$dev->name state is $dev->state<br>"; }
-
The answer to my question in #11 above was "NO", not yes as you stated. You are only processing the final batch. Try something like this <?php $visitor = $_GET["visitor"]; $f_pointer=fopen($visitor,"r"); // file pointer $users = array(); while ($ar=fgetcsv($f_pointer)) { if ($ar[0] != '') $users[] = $ar[0]; //only store line in new array if it contains something } fclose ($f_pointer); $batchSize = 2; // set size of your batches $batches = array_chunk($users, $batchSize); require_once ('MxitAPI.php'); /* Instantiate the Mxit API */ $key = $_GET["key"]; $secret = $_GET["secret"]; $app = $_GET["app"]; $message = $_GET["message"]; $api = new MxitAPI($key, $secret); $api->get_app_token('message/send'); foreach ($batches as $batch) { $list = join(',', $batch); // process the batch list here $api->send_message($app, $list, $message, 'true'); } echo 'Success'; ?>
-
While your at it you may as well format it too in the SQL SELECT DATE_FORMAT(date + INTERVAL 2 HOUR, '%H:%i') as time, ...
-
Well if you replaced the whole of my code with yours then I cannot even know what it is doing now, let alone take any responsibility for it.
-
This will take your date field, add 2 hours and format as time $dt = new DateTime(mysql_result($result,$i,"Date")); $adjustedTime = $dt->add(new DateInterval('PT2H'))->format('H:i'); Don't use mysql_ functions, you will only have to rewrite them all soon when they disappear from PHP and you certainly should not be using mysql_result(). You should be using xxx_fetch_row() or xxx_fetch_assoc() as they are far more efficient
-
Your data table contains "period". Where is that coming from? How does the number you are entering into the fourth field relate to the Monday, Tuesday, ..., Saturday fields in the table? If it is day number to indicate the column, what value goes into the day column? What are you trying to achieve in the end?
-
Are you sending each batch of 50 where I indicated, inside the foreach() loop?
-
- 2 replies
-
- error handling
- fatal error
-
(and 2 more)
Tagged with:
-
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