Jump to content

BrettCarr

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

BrettCarr's Achievements

Member

Member (2/5)

0

Reputation

  1. <?php $mystring = "This is my test string that has {['site_info']} and some more stuff {['taste']} then nothing" ?>
  2. Array ( [0] => Array ( [0] => 11-1-89677-362123164 [1] => 11 [2] => testadmin [3] => 61415676836 [4] => 2011-11-16 [5] => 1 [6] => 0 [7] => 0 [8] => [9] => 0 [10] => 0 [11] => 0 ) [1] => Array ( [0] => 11-1-89688-362186603 [1] => 11 [2] => testadmin [3] => 61415556677 [4] => 2011-08-12 [5] => 0 [6] => 0 [7] => 0 [8] => [9] => 0 [10] => 0 [11] => 0 ) [2] => Array ( [0] => 11-1-89689-362186773 [1] => 11 [2] => testadmin [3] => 61415676836 [4] => 2011-08-12 [5] => 0 [6] => 0 [7] => 0 [8] => [9] => 0 [10] => 0 [11] => 0 ) [3] => Array ( [0] => 11-1-89690-362186926 [1] => 11 [2] => testadmin [3] => 61415223344 [4] => 2011-08-12 [5] => 0 [6] => 0 [7] => 0 [8] => [9] => 0 [10] => 0 [11] => 0 ) ) $final = array(); foreach ($phoneNumberArray as $array[3]) { if(!in_array($array, $final)){ $final[] = $array; } } print_r($final);
  3. <?php $cc = '61'; $ac = '4'; $ph = '8'; $ext = '/0/'; $phoneNumber = '610415676836'; //ok try this $pattern = "'/^$cc([$ac]{1})([0-9]{{$ph}})$/'"; echo $pattern."<br />"; $numlen = strlen($phoneNumber); if($numlen = 12){ $phoneNumber1 = preg_replace($ext,'',substr($phoneNumber,3)); //echo $phoneNumber1; $phoneNumberComplete = $cc.$phoneNumber1; echo $phoneNumberComplete."<br />"; } if(preg_match($pattern, $phoneNumberComplete))// this doen't seem to work { echo "Oh yeh"; } else { echo "boo hiss"; } if(preg_match('/^61[4]{1}[0-9]{8}$/', $phoneNumberComplete))// this does work { echo 'is true'; } else { echo "not doing it"; } //please help ?>
  4. $testemail = '(bobbyboo@sample.com.au)'; echo $testemail; $testemail2 = trim(preg_replace('/^[\(]/', '', $testemail)); echo $testemail2."<br />"; $testemail3 = trim(preg_replace('/$\)/','', $testemail2)); echo $testemail3."<br />";
  5. <?php class User extends Database { function read() { $this->query("SELECT * FROM sales_peepl;"); } function delete($id) { $this->query("DELETE * FROM sales_peepl WHERE salesid = {$id};"); } function output() { return $this->_row->sales_person ." - ". $this->_row->access . " " . '<a href="?=action=$this->delete&id='.$this->_row->salesid.'">delete</a>' . "<br/>"; } } ?> <?php include_once($_SERVER['DOCUMENT_ROOT'] . '/sales/includes/global.php'); $t = new User(); $t->connect(HOST, USERNAME , PASSWORD, DATABASE); $t->read(); ?> <html><head><title></title> </head> <body> <?php while ( $t->next()) { echo $t->output() . " "; } ?> </body> </html>
  6. Cool you were right session_start() was the problem i didn't have it in the ajax file..... Thanks Man.. Now its beer time
  7. function addDatadb() { myarray = <?= json_encode($_SESSION['batcharray']) ?>; send( '/ajax/arrayclean.php', 'myarray=' + myarray, null , addDatadbRecv ); } function addDatadbRecv(data) { $_SESSION['batcharray'] = data; } this is whats in ajax/arrayclean.php <?PHP include_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.php'); $db = new Database(); $db->connect(); $batcharry = $_REQUEST['myarray']; $parts = array_map(create_function('$e', 'return implode("','", $e);'), array_chunk(explode(',', $batcharry), 13)); //var_dump($parts); foreach ($parts as $value) { $comma_separated = implode("','", $value); //var_dump($comma_separated); eval("\$comma_separated = \"$comma_separated\";"); $myquery = "INSERT INTO batch_import VALUES(null,'$comma_separated','0');"; //echo $myquery . "<br />"; $db->query($myquery); } if (isset($_REQUEST['myarray'])) { unset($_REQUEST['myarray']); echo $_REQUEST['myarray']; } ?> so when$_REQUEST['myarray'] is emptied im sending back to client side and want to replace whatsin $_SESSION['batcharray'] with whats in data.... nothing
  8. <?php $teststring = "2010-03-14,74527,645,New,7417417,Toll,2,74527417,32,202,7452741741,ghtgbwt,gtgwtgwtfgwtrg,2010-03-14,857527527,645,New,7417418,Toll,7,74527418,32,202,527527,hjm,djmdmdjmdjmdgjm,2010-03-14,85285,645,New,7417419,Toll,2,74527419,32,202,750757,jryjkryjkfryk,yjmyjyjtyjhm"; $teststring1 = preg_replace("/([a-zA-Z0-9_\-]+?),/" , "\"$1\",",$teststring); $teststring2 = preg_replace("/\,{13}/" , "],[",$teststring1); var_dump($teststring2); ?>
×
×
  • 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.