-
Posts
116 -
Joined
-
Last visited
Posts posted by canabatz
-
-
im getting the time from other server and the date dosent change there it's showing same date but times after midnight also.
what i need is programaticly change the date myself with a script.
thanks
-
hi all
i have an array that hold times as follow(i define the date):
2016-02-24 16:55
2016-02-24 17:55
2016-02-24 19:55
2016-02-24 23:55
2016-02-24 01:34 -<----here is my problem , i want the date to change if it's after midnight.
it shuold be like that automaticly:
2016-02-25 01:34somthing like that:
$day="2016-02-26"; if(strtotime(01:34) > strtotime("23:59")) { $day = date('Y-m-d',strtotime($day."+1 days")); } else { //KEEP CURRENT DATE }
the time im geting from a web site with file_get_contents and there the date do not change if after midnight so i got to do it my self
any help ?
thanks
-
thanks Barand, works perfect!!
-
i changed it to:
$results = array( array('name'=>'carl', 'good'=>4, 'time'=>14), array('name'=>'john', 'good'=>4, 'time'=>25), array('name'=>'benny', 'good'=>5, 'time'=>21) ); usort($results, 'resultSort'); echo $results[0]['name']; // benny
-
PHP Parse error: syntax error, unexpected '[' in /home5/bingoga1/public_html/shiluvyco/trivika/calct.php on line 5
-
the sorting is not workig
-
hi all,im trying to get best results from this listname--------good---------best timecarl------------1 ---------14john------------2 ---------25benny----------2 ---------21good represent right answer and bet time represent speed.i need to find who answer most and the least time.so the best from the example is 2-21i have put the results in array and found the max(good) and the min(best time)how can i found that benny won in table example, he had 2 good and is best time is better then john, carl is out because he have only 1 good.thanks
-
Hi,
i got problem in foreach loop, the code is stuck on first loop.
any one see any problem in the code?
im stuck on it for a day now.
thanks !
function get_rss() { global $catArray, $yesterday, $date; $rss = mysql_query("SELECT id, cat, tcat, title, pic FROM portal_coverages WHERE v = 1 AND date BETWEEN ('" . $yesterday . "') AND ('" . $date . "')ORDER BY id DESC"); $resultp = array(); while($row = mysql_fetch_object($rss)) { $resultp[$row -> cat][$row -> tcat] = $resultp[$row -> cat][$row -> tcat] . " <tr> <td><p style='color:#F91010;'>" . $catArray[$row -> cat . "," . $row -> tcat] . "</p></td> <td><img src='http://dossinet.me/" . $row -> pic . "' width='50' height='50' /></td> <td>" . $row -> title . "</td> <td><a href='http://dossinet.me/view," . $row -> id . ".html'>קישור </a></td> </tr> "; } return $resultp; } include("rss/mail_class.php"); $kk=1; $query = mysql_query("SELECT rss_id, user_id FROM `portal_rss`")or die(mysql_error()); $get_rss = get_rss(); while($row = mysql_fetch_object($query)) { $rss_id = unserialize($row -> rss_id); foreach($rss_id as $key) { $x = explode(',', $key); if(!empty($get_rss[$x[0]][$x[1]])) { $title .= $catArray[$key] . ', '; $result .= $get_rss[$x[0]][$x[1]]; } } if(!empty($result)) { $query = mysql_query("SELECT * FROM `user` WHERE `userid` ='" . $row -> user_id . "'")or die(mysql_error()); $rowz = mysql_fetch_array($query); $user['name'] = $rowz['username']; $user['email'] = $rowz['email']; $params = array( 'file' => 'rss', 'subject' => "עדכוני קטגוריה - " . $title, 'from_name' => "עדכוני קטגוריה ", 'vars' => array('cat' => $title, 'post' => $result, 'name' => $user['name']), ); Mail::To($user['email']); Mail::set_mail($params, true); Mail::send_mail($params); } }
-
hi,
i got this url:
www.world-status.com/&page=2
how can i make it like that:
www.world-status.com/page/2
i got this at the moment:
RewriteRule ^([^/.]+)/?$ /index.php?cat_id=$1
RewriteCond %{HTTP_HOST} ^world-status.com
RewriteRule (.*) [world-status.com...] [R=301,L]
RewriteCond %{THE_REQUEST} \/index.php\ HTTP [NC]
RewriteRule (.*)index.php$ /$1 [R=301,L]
thanks
-
Thanks AGuyWithAthing, im going to try that!!
-
i need to get two or more of id ranges :
for example
id value
1 1
2 1
3 0 -
4 0 -
5 0 -
6 1
7 1
8 0 -
9 0 -
10 0 -
11 1
12 1
13 1
i want to get the starting id 0f the value 0 to the Third value 0 so the result will be 3-5 and i need to get the second one also
8-9.
what is the easiest way to do that? or where to start?
thanks
-
Exactly
Thanks SergeiSS
-
im little bit sick , it was hard for me to think well , any way thanks for th push
for ($i=1; $i<=3; $i++) { for ($z=4; $z<=6; $z++) { echo $i; echo $z."<br>"; } }
-
how can a get this result in for loop:
1 4
1 5
1 6
2 4
2 5
2 6
3 4
3 5
3 6
thanks
-
Thanks alllllooot man, it's working!!!
-
Hi mjdamato , i dont know how to thank you for taking the time to write and test this code.
your code is perffect! but i got small problem.
im trying to get the results from the database while doing what i need .
$sql=mysql_query("SELECT * FROM `my_table` ")or die(mysql_error()); while ($row=mysql_fetch_assoc($sql)) { $testArray= array( array ('res' =>$row['something'], 'number' =>$row['something else']), ); } $lastRes = 1; foreach($testArray as $row) { if($row['res'] == 0 && $lastRes !== 0) { //This line is only executed if 'res'=0 and the last 'res' was not 0 $res11 = $row['number']; echo "A New '0' was encountered. res11 now equals {$res11}<br>\n"; } $lastRes = $row['res']; }
im not geting anny result back , if i put your test code it's working!!
can it be a problem to add returned results from the database in the while loop!!
thanks a Billion!
-
mjdamato,
your code is good, but only for one number.
the code dose not get the new number result!
any why to do it differently ?
thanks
-
Im not php Professional yet.
a little example will be perfect
thanks
-
thanks mjdamato.
but if there is res=1
how do i skip it?
-
can this work:
$insideAStringOfZeroes=''; if ($res==0 && $insideAStringOfZeroes!=1) { $insideAStringOfZeroes=1; // do something } else if ($res==1) { // do nothing $insideAStringOfZeroes=0; }
-
Hi all,
i have this records that coming from the database:
0
0
0
1
1
1
1
1
0
0
1
1
1
1
1
1
i want to build a loop that will do like that:
if ($res==0) {$res11==number}
if ($res was allready 0 ignore it)
if ($res==1 ignore it and all other $res=1 and wait till it's $res=0 again
if ($res==0 again) { $res11==newnumber }
please guide me to doing that, im stuck!
thanks
-
try now
<?php /* Get the letter user clicked on and assign it a variable called $sort */ $sort = $_REQUEST['letter']; /* Let's check if variable $sort is empty. If it is we will create a query to display all customers alphabetically ordered by last name. */ if($sort == ""){ $qry= "SELECT * FROM myDatabase.t_clientes ORDER BY company_name ASC " ; }else{ /* if varible $sort is not empty we will create a query that sorts out the customers by their last name, and order the selected records ascendingly. */ $qry = "SELECT * FROM myDatabase.t_clientes WHERE company_name LIKE '$sort%' ORDER BY company_name ASC" ; } /* Notice the use of '%' wilde card in the above query "LIKE '$sort%'". */ //next step is to execute the query. $execute = mysql_query($qry) or die(mysql_error()); ?> <td width="551" align="left" nowrap="nowrap" class="UsuarioNombreHeader"> <?php for ($i = 65; $i < 91; $i++) { printf('<a href="%s?letter=%s">%s</a> | ', $PHP_SELF, chr($i), chr($i)); } echo " " ; //print t alphabet */?> </td> <table width="850" align="center" border="0" cellpadding="5" cellspacing="0" class="BottomLine"> <?php if(mysql_num_rows($execute)>0){ do{?> <tr> <td> <td width="27%" align="left" nowrap="nowrap" class="AddressTXT"><strong><?php echo $result['company_name']; ?></strong></td> <td width="20%" align="left" nowrap="nowrap" class="AddressTXT"><strong>tel.<?php echo $result['cliente_tel']; ?></strong></td> <td width="27%" align="left" nowrap="nowrap" class="AddressTXT"><?php echo $result['cliente_email'];?></td> <td width="2%" align="center" class="CP_errorLoginTxt"><a href="PC_contactos_sendmail.php?id_cliente=<?php echo $result['id_cliente']; ?>"><img src="CP_img/icono_email_reducido.png" alt="" width="15" height="10" border="0" /></a></td> <td width="2%" align="center" class="CP_errorLoginTxt"><a href="PC_contactos_update.php?id_cliente=<?php echo $result['id_cliente']; ?> "onclick="return confirm('¿Seguro que desea \n ELIMINAR PERMANENTEMENTE \n <?php echo $result['company_name']; ?>?');"><img src="CP_img/icono_editar_reducido.png" width="20" height="13" border="0" /></a></td> <td width="2%" align="center" class="CP_errorLoginTxt"><a href="PC_contactos_delete.php?id_cliente=<?php echo $result['id_cliente']; ?> "onClick="return confirm('¿Seguro que desea \n ELIMINAR PERMANENTEMENTE \n <?php echo $result['company_name']; ?>?');"><img src="CP_img/icono_borrar_reducido.png" width="15" height="10" border="0" /></a></td> </tr> <?php }while($result = mysql_fetch_assoc($execute)); }else{ echo " No contacts found " ; } ?> </table>
-
try that:
<?php /* Get the letter user clicked on and assign it a variable called $sort */ $sort = $_REQUEST['letter']; /* Let's check if variable $sort is empty. If it is we will create a query to display all customers alphabetically ordered by last name. */ if($sort == ""){ $qry= "SELECT * FROM myDatabase.t_clientes ORDER BY company_name ASC " ; }else{ /* if varible $sort is not empty we will create a query that sorts out the customers by their last name, and order the selected records ascendingly. */ $qry = "SELECT * FROM myDatabase.t_clientes WHERE company_name LIKE '$sort%' ORDER BY company_name ASC" ; } /* Notice the use of '%' wilde card in the above query "LIKE '$sort%'". */ //next step is to execute the query. $execute = mysql_query($qry) or die(mysql_error()); /* Before we display results let's create our alphabetical navigation. for ($i = 65; $i < 91; $i++) { printf('<a href="%s?letter=%s">%s</a> | ', $PHP_SELF, chr($i), chr($i)); } echo " " ; /* now we are ready to display the results. */ ?> <table width="400" border="1"> <tr> <td>client</td> <td>company name</td> <td>Phone</td> </tr> <?php if(mysql_num_rows($execute)>0){ do{ ?> <tr> <td><?php echo $result['id_cliente']; ?></td> <td><?php echo $result['company_name']; ?></td> <td><?php echo $result['cliente_tel'];?></td> </tr> <?php }while($result = mysql_fetch_assoc($execute)); }else{ echo " No customer found. " ; } ?> </table>
-
from your first code:
<?php if(mysql_num_rows($execute)>0){ do{ echo " " .$result['id_cliente']. " " .$result['company_name']. " " .$result['cliente_tel']. " " ; }while($result = mysql_fetch_assoc($execute)); }else{ echo " No customer found. " ; } ?>
does it display all records? or just one?
how many records there is?
change date after midnight
in PHP Coding Help
Posted
Thanks a lot , exactly what i needed