colap
Members-
Posts
302 -
Joined
-
Last visited
Everything posted by colap
-
<?php require_once 'functions.php'; $dbh = mysql_connection(); $email_token = $_REQUEST['email_token']; $objDateTime = new DateTime('NOW'); $current_datetime = $objDateTime->format("Y-m-d H:i:s"); $statement = $dbh->prepare("select * from p_users where email_token=:email_token and email_token_expiry>:current_datetime"); $result = $statement->execute(array(':email_token'=>$email_token, ':current_datetime'=>$current_datetime) ); $rc = $statement->rowCount(); From database: mysql> select id,username,email,email_token,email_token_expiry from p_users; +----+----------+----------------------+-------------+---------------------+ | id | username | email | email_token | email_token_expiry | +----+----------+----------------------+-------------+---------------------+ | 7 | abc | abc@yahoo.com | krl5g085wy | 2014-04-12 08:18:33 | +----+----------+----------------------+-------------+---------------------+ 1 row in set (0.00 sec) What can be the reason to get zero row? How can i debug pdo statement?
-
$objDateTime = new DateTime('NOW'); $created = $objDateTime->format("Y-m-d H:i:s"); From mysql table created = 2014-04-10 15:50:19 I want to add 24 hours or 1 day with this datetime. How can i do this?
-
$("input.class_input_button_send").on("click",function(event) { event.preventDefault(); //var username = $("input.class_input_hidden").val(); var typed_text = $("input#id_input_text_type").val(); console.log(typed_text); rt = $.ajax({ type: "POST", url: "send.php", data: { name: "", typed_text: typed_text }, success: function(data) { console.log(data); console.log(data.length); } }).done(function() { alert( "success" ); }) .fail(function() { alert( "error" ); }); //console.log(rt); }); send.php =><?php <?php if( session_id() == '' ) { session_start(); } if($_SERVER['SERVER_PROTOCOL'] == "HTTP/1.1") { $domain_host_root = "http://" . $_SERVER['SERVER_NAME'] . "/"; } require_once 'core/model/mysql/mysqldb.php'; require_once 'core/utility/debug-app.php'; require_once 'core/utility/utility.php'; require_once 'core/view/view.php'; //$_POST['typed_text'] = "abc"; $typed_text = $_POST['typed_text']; $objDateTime = new DateTime('NOW'); $target_file = $objDateTime->format("Y-m-d"); $handle = fopen("archive/" . $target_file . ".txt", "w+"); fwrite($handle, $target_file_data); echo json_encode($target_file); ?> fopen function is working inside that send.php script if i run this as a standalone script, but fopen function returns null through the jquery $.ajax() function.
-
How to insert string with dollar sign ($) into mysql table?
colap replied to colap's topic in PHP Coding Help
PHP interprets the string starting with dollar sign as variable. So it doesn't insert that string into mysql table. -
$_SERVER['argv'][1'] = "$GGGabcd"; $query = "insert into table1 (str) VALUES(' " . $_SERVER['argv'][1] . " ')"; It's a string that starts with a dollar sign. So how can i insert this string into mysql table with php? How can i escape or something to add that string with $ (dollar) ?
-
How can you get the value of parameters in php script? I think, the answer is : print_r($_SERVER['argv']);
-
Hi, There is C socket server that gets data from device. I need to pass the data from socket to php script. How can i do this? Can anyone post some sample code? Is it a correct format? system('/usr/bin/php file.php param1 param2'); Now how can i get the data from this? Or is there any other better way to pass data to php script?
-
http://www.php.net/manual/en/pgsql.examples-basic.php Is it the prefered/suggested/recommended way to connect with postgresql database with php? Or should i use pdo or something else? http://www.php.net/manual/en/pdo.pgsqllobcreate.php For mysql the pdo is recommeded by php users.
-
Which mechanism should i use before saving password into mysql table? md5,sha1, or any crypting method. Please recommend/suggest something.
-
I installed the php.exe so i got a PHP/ folder in C:\ and i also have installed mysql.msi. Now what else do i have to do to configure and run these with their correct connectivity? If i uncomment these line in php.ini, will it do the job? Do i have to do anything special to configure mysql with php on windows 7?
-
How Can I Insert String With Single And Double Quote Into Mysql Table?
colap replied to colap's topic in PHP Coding Help
How can i insert string with starting and ending double quoutes? -
Shouldn't json have in this format { ... } , where is the { .. } bracket here: ["23.80484,090.40694","23.79942,090.41605","23.79118,090.41692"]
-
Is it the correct json format, in both example json_encode has been used. ["23.80484,090.40694","23.79942,090.41605","23.79118,090.41692"]
-
array(3) { [0]=> string(18) "23.80484,090.40694" [1]=> string(18) "23.79942,090.41605" [2]=> string(18) "23.79118,090.41692" } string(64) "["23.80484,090.40694","23.79942,090.41605","23.79118,090.41692"]" Is it the correct json format after json_encode ? Isn't the json format contains { .. } ? <?php $arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); echo json_encode($arr); ?> The above example will output: {"a":1,"b":2,"c":3,"d":4,"e":5} http://php.net/manua...json-encode.php
-
Given array Array ( [Post] => Array ( [title] => new with has many through for tags [body] => hello tags [category_id] => 11 [tags] => one two three [mark] => 1 ) ) I need to make an array something like this: Array ( [Post] => Array ( [title] => new with has many through for tags [body] => hello tags [category_id] => 11 [mark] => 1 ) [Tag] => Array ( [0] => Array( [name] => one ) [1] => Array( [name] => two ) [2] => Array( [name] => three ) ) ) How can i make it?
-
How can i check if associate array element is empty or not?
colap replied to colap's topic in PHP Coding Help
What about isset and is_null function? -
Array ( [Comment] => Array ( [post_id] => 1 [name] => cc [email] => [body] => spam ) ) How can i check if email is empty or not? Is there any php built in function? Should i use foreach?
-
Look at my original question. There i have told that it will be changed into <pre class="brush:cpp">. Though html_entity_decode does this job, but i don't want to do html_entity_decode for <br/> and other html elements. Other html elements will be as those were. Only you have to convert it to <pre class="brush:cpp">. But if i do html_entity_decode($alltexts); it converts all html element, that's not what i want.
-
Hello, I need to do html_entity_decode for only one html code, not all html element.
-
This is not yet solved.
-
<pre> <pre class="brush:cpp"> <pre class="brush:javascript"> Those can be cpp,javascript,python ... etc. I need to change/replace these into: <pre> <pre class="brush:cpp"> <pre class="brush:javascript"> Those can be cpp,javascript,python ... etc. I need a generic regular expression for this? Can anyone provide the generic regular expression for this to replace? Trying=> $abc = str_replace(array($generic-regular-expression),'<pre> or <pre class="brush:cpp"> or <pre class="brush:javascript"> ..... ',$str);