bh
Members-
Posts
238 -
Joined
-
Last visited
Everything posted by bh
-
The structure is like an ini file. Try to parse your file with http://php.net/manual/en/function.parse-ini-file.php
-
Then why dont you get only the images src's contain?
-
@kenrbnsn: and i dont understand this: $new = substr($keys,30,7); why the fix 30 whether ? @playwright: you should specify the task.
-
heres the problem: $keys = implode("+",$y[$i]); $new = substr($keys,30,7); $keys is an array... so concate $keys elements simple example: $keys = implode("+",$y[$i]); $str = ''; foreach ($keys as $key) { $str .= $key; } $new = substr($str,30,7);
-
Hi, Exmaple replace the % sign to empty in the Percentage column, and then convert it to decimal. After that you can order it as an integer, like that: SELECT Rank, Name, Percentage FROM leader_board ORDER BY CONVERT(REPLACE(a, '%', ''),DECIMAL), Name;
-
Its ok. And if i run this query its ok too. And the time zone works too. '+5:00' = add 5 hours to UTC. SET GLOBAL time_zone = '+5:00'; INSERT INTO `tracker` ( `id` , `ip` , `date` , `status` , `userAgent` ) VALUES ( NULL , '10.10.10.10', NOW() , '10101', 'nothing' );
-
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE); $query = "SET GLOBAL time_zone = '-2:00'; INSERT INTO tracker (ip, date, status, userAgent) VALUES ('{$ip}', NOW(), '{$status}', '{$userAgent}');"; if ( ! $mysqli->query($query)) { echo $mysqli->error(); } $mysqli->close(); if it doesnt work its not the query... your table structure maybe wrong...
-
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE); $query = <<<EOD SET GLOBAL time_zone = '-2:00'; INSERT INTO tracker (ip, date, status, userAgent) VALUES ('{$ip}', NOW(), '{$status}', '{$userAgent}'); EOD; if ( ! $mysqli->query($query)) { echo $mysqli->error(); } $mysqli->close(); sorry, i dont see its mysqli... so the get error message is: $mysqli->error();
-
timestamp is ok. just echo mysql_error(); and we'll see the exact error
-
If only this one is in the query is it work? SET GLOBAL time_zone = '-2:00'; What is the error message?
-
From the manual: so... $query = <<<EOD SET GLOBAL time_zone = '-2:00'; INSERT INTO tracker (ip, date, status, userAgent) VALUES ('{$ip}', NOW(), '{$status}', '{$userAgent}'); EOD;
-
you should check your value. if $_GET['race'] doesnt exists... if (isset($_GET['race'])){ // Line 93 $racer = $_GET['race'];
-
Well, i given you a link... An easy example: after you connected your database, type this command: SET GLOBAL time_zone = type_here_the_timezone; After that command your time zone will always be what you typed... It was only an example
-
The clearly solution is modifing the mysql time-zone. Else you have to handle all INSERT and UPDATE statements [when you use NOW()] with the example code. Example: UPDATE table SET updated_time = DATE_SUB(NOW(), INTERVAL 2 HOUR) WHERE id=2;
-
Hi, http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html SELECT DATE_ADD(NOW(), INTERVAL 2 HOUR); SELECT DATE_SUB(NOW(), INTERVAL 1 HOUR);
-
Hi, you need http://php.net/manual/en/function.array-key-exists.php function
-
Hi, private $name = 'rohith$kodakandla'; ' -> it doesnt parse the variable or escabe the $ character private $name = "rohith\$kodakandla";
-
Hi, you cant index your array with a numeric becouse that is an accociative array. create an enumerative array from your ass.arr example like this (with foreach or use @ProjectFear suggestion [array_values()] which is more beautiful i think): $new_array(); foreach ($names as $name) { $new_array[] = $name; } and after that you can index with a number your enumerative $new_array that holds your $names array content. edit: yeah, i was a bit mindful with the code, sry: $new_array(); foreach ($names as $k => $name) { $new_array[] = $name; }
-
Youre welcome. Thats the ternary operator: (condition statement) ? 'if condition is true this will be the actual value' : 'if condition is false than this'
-
Yeah its not recommended as name type names (int, varchar...). But heres an ugly solution (dont use it, rather rename the column): INSERT INTO dogs ( ... `int` ... ) VALUES (... If you use altgr+7 (i dont know the character name) it will works. sorry, i wasnt mindful (PFMaBiSmAd ~wrote the same)
-
Hi, example break from the for loop like this: $num_of_images = 10; for ($i=1; $i<count($files); $i++) { $num = $files[$i]; echo '<img src="'.$num.'" alt="random image">'." "; if ($i >= $num_of_images) break; } or $num_of_imgs = count($files); $num_of_imgs = ($num_of_imgs > 11) ? 11 : $num_of_imgs; for ($i=1; $i<$num_of_imgs; $i++) { $num = $files[$i]; echo '<img src="'.$num.'" alt="random image">'." "; }
-
Yeah... (it was only an example, i dont specify for your script) $cdata = $dom->createCDATASection( $about ); $cdata = $doc->createCDATASection( $about );
-
from google! // create CDATA section $cdata = $dom->createCDATASection("\nCustomer requests that pizza be sliced into 16 square pieces\n"); $root->appendChild($cdata);
-
$a1 = appendChild($doc->createTextNode( $about ) ); $r->appendChild( $a1 ); -> $a1 = $doc->createTextNode( $about ); $r->appendChild( $a1 );
-
Hi fellas, Im relative new here. My names Adam and im working at a middle company in Hungary as a PHP developer. My main PHP interestings are ORMs, FrameWorks (prefer CodeIgniter and ZendFw), security issues and any kind of script optimization for higher code speed. My hobbies are football and playing Xbox360 (all series of CoD, Fifa) and i like strategy and rpg games on pc