Jump to content

venkatpvc

New Members
  • Posts

    7
  • Joined

  • Last visited

venkatpvc's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. try this, i have added the regexp to test before adding letter to make sure letter not exists. pattern search only first letter and last only to make not search in actual search string i have used space after letter and before letter. I am sure you can do this without regexp also, but i just add validation before passing it to function. var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789".split(""); $.each(alphabet, function(key, val) { var regex = new RegExp("^" + val + ' ', "g"); if (regex.exec(search_input) == null) { //console.log(val + ' '+ search_input); callAPI(val + ' '+ search_input); } var regex = new RegExp(val + ' ' + "$", "g"); if (regex.exec(search_input) == null) { //console.log(search_input + ' ' + val); callAPI(search_input + ' ' + val); } });
  2. while Ch0cu3r said works perfectly. for learning purpose you can try below too. <?php /*$test = 0; if ($test === "Y") { echo "Hello world"; }*/ //or you can set type explicitly and test $test = 0; settype($test, "integer"); if ($test == TRUE && $test == "Y") { echo "Hello world"; } ?>
  3. what is your max uploaded limit in your php.ini file if not what you needed try change in php.ini ; Maximum allowed size for uploaded files. upload_max_filesize = 128M
  4. clear explanation of picture from Jacques1. how it can done properly. but for learning purpose you can try below.. <?php foreach($rows as $row) { $get_expiry_time = $row['expiry_time']; <div class="record"> <div class="timer"> </div> </div> ?> <script> $(document).ready(function(){ var countDownTime = <?php echo $get_expiry_time; ?>; function countDownTimer() { var hours = parseInt( countDownTime / 3600 ) % 24; var minutes = parseInt( countDownTime / 60 ) % 60; var seconds = countDownTime % 60; var result = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds); $('.timer').html(result); if(countDownTime == 0 ){ countDownTime = 60*60*60; } countDownTime = countDownTime - 1; setTimeout(function(){ countDownTimer() }, 1000); } countDownTimer(); }); </script> <?php } ?>
  5. Friends, I am creating class to create table and have tried with below script passing array to bindParam. but it's giving me below sql syntax error I really can't figure out what it is. please help on this. public function generate_table($Table_Name, array $Table_Elements) { $array_elements = implode(', ', $Table_Elements); if ($this->db) { $qry = 'CREATE TABLE IF NOT EXISTS ? (?);'; $stmt = $this->db->prepare($qry); $stmt->bindParam(1, $Table_Name, PDO::PARAM_STR); $stmt->bindParam(2, $array_elements, PDO::PARAM_STR); $stmt->execute(); if ($stmt->errorInfo()) { var_dump($stmt->errorInfo()); } if (!$stmt->errorInfo() && $stmt) { echo "Table Created";} } } array(3) { [0]=> string(5) "42000" [1]=> int(1064) [2]=> string(226) "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''STU_INFO' ('STU_ID INT NOT NULL AUTO_INCREMENT, STU_FIRST_NAME VARCHAR(25) NOT ' at line 1" } I am passing array to script like below $obj = new Create_Table('/home/ubuntu/workspace'); $obj->generate_table('STU_INFO', array ('STU_ID INT NOT NULL AUTO_INCREMENT', 'STU_FIRST_NAME VARCHAR(25) NOT NULL', 'PRIMARY KEY (STU_ID)'));
  6. you could try like below; if (!$dbh) { $errormsg = "Failed to connect"; } else { $errormsg = "Connected to DataBase"; }
  7. With respect to requinix replay; can this help to you? <?php $arr = array(); if (isset($_POST['submit'])) { foreach($_POST as $key=>$value) { if ($value != 'submit') { if ($value >= 0.0 && $value <= 10.0) { $arr[$key] = $value; } } } foreach($arr as $key=>$val) { echo $key." Value inserted by User: <strong>".$val."</strong>\n"; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.