Jump to content

spires

Members
  • Posts

    492
  • Joined

  • Last visited

Everything posted by spires

  1. Worked it out $findImg = preg_match_all('/<a(.*)<\/a>/i',$cleanMeg, $result); $stripFirstImg = str_replace($result[0][0], "", $cleanMeg); Thanks anyway.
  2. Hi I'm pulling my data from a database. I'm trying to grab the first <a> and place it in a String. Any ideas? <a> Tag: <a href="http://lwww.mysite,com"><img alt="" src="/media/lci_strip.png" style="width: 701px; height: 92px; " /></a> What I have so far - but not working: $findImg = preg_match_all('/<a[^</a>]+</a>/i',$cleanMeg, $result); $stripFirstImg = str_replace($result[0][0], "", $cleanMeg); Thanks
  3. Hi I have a string that is pulled from a database. I want to remove the title, but not sure how I do it. I was trying something like this: $string = '<strong>Dynamic Title, so will be different on every loop</strong> Rest of text etc'; $newString = preg_replace('<strong>[^A-Za-z0-9_-]+</strong><br />', '', $string); Any ideas? Thanks
  4. Hi Thanks for your reply. This is the header for every page. So what happens here happens all over. I'm guessing that the SESSION is getting populated with the GET. But as the next page has not GET, the SESSION end up blank. Which is why I have the IF. But that dose not seem to work. Global. How do I pass a variable from my main file to the header file, without global ? Thanks
  5. Hi I'm trying to save a $_GET[] in to a session. It's working on the page that is GETTING the variables from the url, but soon as I click to the next page the SESSION seems to empty out. Any Ideas? Header Script <?PHP session_start(); require_once('../../../includes/initialize.php'); global $page; global $metTitle; global $metDesc; global $metKey; $getFM = $_GET['fm']; $getKW = $_GET['kw']; $getGR = $_GET['gr']; if(!empty($getFM)){ $from = $_SESSION['FM'] = $getFM; }else{ } if(!empty($getGR)){ $interest = $_SESSION['GR'] = $getGR; }else{ } if(!empty($getKW)){ $ref = $_SESSION['KW'] = $getKW; }else{ } echo $getFM.' - '.$interest.' - '.$from.' - '.$ref; ?> Thanks
  6. Plue: $send = Form_signup::send_notification('email', 'BM', 'BM', 'email', $body_content, $subject); echo $send; Returns 1 So it should be working
  7. Hi All the Variable are getting pushed in to the function: send_notification($sendTo, $name, $from_name, $from_email, $body_content, $subject) As I can echo them out. So I'm guessing it would be in this section: public function send_notification($sendTo, $name, $from_name, $from_email, $body_content, $subject){ $mailMessage =<<<EMAILBODY {$body_content} EMAILBODY; $mailMessage = wordwrap($mailMessage, 70); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "localhost"; $mail->Port = 25; $mail->SMTPAuth = false; $mail->isHTML(TRUE); $mail->FromName = $from_name; $mail->From = $from_email; $mail->AddAddress($sendTo, $name); $mail->Subject = $subject; $mail->Body = $mailMessage; $result = $mail->Send(); return $result; } I ideas would be a great help thanks
  8. Hi. I'm using PHP mailer. But I can't get it to send the Email: Class: public function send_notification($sendTo, $name, $from_name, $from_email, $body_content, $subject){ $message =<<<EMAILBODY {$body_content} EMAILBODY; $message = wordwrap($message, 70); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "localhost"; $mail->Port = 25; $mail->SMTPAuth = false; $mail->isHTML(TRUE); $mail->FromName = $from_name; $mail->From = $from_email; $mail->AddAddress($sendTo, $name); $mail->Subject = $subject; $mail->Body = $message; $result = $mail->Send(); return $result; } PHP $body_content = ' Dear BusinessMobile.com <br /><br /> A website user has filled in the form on the website. See the details below. <br /><br /> Company: '.$company.'<br /> Name: '.$name.'<br /> Email: '.$email.'<br /> Tele: '.$telephone.'<br /> Message: '.$message.'<br /><br /> Interest: '.$Fpage.'<br /> Reference: '.$ref.'<br /><br />'; $subject = 'BusinessMobile.com - Contact Request'; Form_signup::send_notification('spires1@mail.com', 'BM', 'BM', 'spires1@mail.com', $body_content, $subject); Any ideas where i'm going wrong ? Thanks
  9. Hi Simple question, how do I reFormat a date. $dateCreated (2012-01-14) to become: 14th jan 2012 So far I have this, but it's not working: $expDate = explode('-',$dateCreated); $date1 = mktime(0, 0, 0, date('m', $expDate[1]), date('d', $expDate[2]), date('Y', $expDate[0])); $date = date('d m Y', $date1); Thanks
  10. CREATE TABLE IF NOT EXISTS `admin_emails_desc` ( `id` BIGINT( 11 ) NOT NULL AUTO_INCREMENT , `admin_emails_id` BIGINT( 11 ) NOT NULL DEFAULT '', `lang_id` BIGINT( 11 ) NOT NULL DEFAULT '', `name` VARCHAR( 150 ) NOT NULL DEFAULT '', `subject` VARCHAR( 150 ) NOT NULL DEFAULT '', `body_content` TEXT NOT NULL , `from_name` VARCHAR( 150 ) NOT NULL DEFAULT '', `from_email` VARCHAR( 250 ) NOT NULL DEFAULT '', PRIMARY KEY ( `id` ) , FOREIGN KEY ( `admin_emails_id` ) , FOREIGN KEY ( `lang_id` ) ) ENGINE = MYISAM AUTO_INCREMENT =1 MySQL said: #1064 - 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 ' FOREIGN KEY (`lang_id`) ) ENGINE=MyISAM AUTO_INCREMENT=1' at line 11
  11. Hi, Thanks thats a big help Much appreciated. I'll look into how Google works. Thanks
  12. lol, Sorry it is a PHP question. Basically, yes I don't know where to get the info, which I'll be able to find. But also don't know who to structure the DB. What I'm after doing to just like on the dating sites. Where you can select an area, e.g London, then view profiles with a selected mile radious. e.g 10 miles. I'm assuming it is to do with the IOS. Before I had: Country - id - name Country - id - countryID - name Area - id - countryID - countyID Areacode - id - code But this is not going to allow me to do what I need. Any idea, ho I should be structuring it? Thanks
  13. yeah, Where I can find the information. I've got the countries, but thats it so far. Thanks for your help
  14. Hi I'm trying to build a register page for an international website. I currently have the IOS Code E.G: AFGHANISTAN AF AFG But how do I go about getting all of the sub Derivatives ? E.G UK - Essex, Harlow, London, Manchester etc Thanks
  15. Do you mean like this? $newChild = call_user_func_array(array($className, 'find_by_id'), array($LPlistID));
  16. Hi. Thanks again. But what If I want to pass the class an ID, or multiple variables? E.G: find_by_id(10);
  17. $newParent = call_user_func(array($wrapperName, 'find_all')); Works perfect Thanks for that. Do you know when 5.3 will be stable on all hosting? I'm only on 5.2.17 currently. Thanks Again
  18. Hi I'm doing some OOP But can not find a way to make the class name dynamic. I'm sure there must be a way of doing it, as I use this a lot, i'm sure other must also. This is what I have: $wrapperLCID = $newListWrappers->list_category_id; $wrapperName = $newListWrappers->name; if($wrapperLCID==1){ $newParent = Business_solutions_cat::find_all(); }elseif($wrapperLCID==2){ $newParent = Blackberry_cat::find_all(); }elseif($wrapperLCID==3){ $Pcategory = Case_studies_cat::find_all(); }elseif($wrapperLCID==4){ $Pcategory = Stand_alone_cat::find_all(); }elseif($wrapperLCID==5){ $newParent = Reasons_cat::find_all(); }elseif($wrapperLCID==6){ $newParent = Charity_cat::find_all(); } This Is What I want: $wrapperLCID = $newListWrappers->list_category_id; $wrapperName = $newListWrappers->name; $newParent = $wrapperName::find_all(); Thanks for your help
  19. ok thanks. But can't get that to work. I'm now trying: $adgroup = $_POST['adgroup']; // This is an array, 100's of keywords $arrValues = array(); for($v=0;$v<$value;$v++){ $arrValues[] = $v; foreach($adgroup as $adgroups){ $cleanGroup = trim($adgroups); $arrValues[$v] = $cleanGroup; } } print_r($arrValues); This works great. But, I can't keep adding to the array. E.G: $v = 1 $arrValues[$v] = $cleanGroup; So, what I want is: $arrValues[1]['key1']; $arrValues[1]['key2']; $arrValues[1]['key3'];
  20. Hi, Thanks. That all look good, but how does the value also get in there? E.G $array[1]['key1']; $array[1]['key2']; $array[2]['key1']; $array[2]['key2']; Thanks
  21. Hi. I'm guessing this should be easy, but having never used them i'm stuck. I have an array and count that i'm trying to place inside of a Multidimensional array. $value = count from 1-infinite $keywords = an Array contain X amount of stings. What I want to do, (on submit) is join the two together in to one array. So the lists of "$keywords" can be referenced by a $value. E.G: value1 => keyword1 value1 => keyword2 value1 => keyword3 value2 => keyword1 value2 => keyword2 value2 => keyword3 etc So, I'm thinking something like this, but i'm purely guessing here: $value = 1; $keywords = array("key1", "key2", "key3"); $arr = array($value => array($keywords)); //then loop through foreach($arr as $val){ foreach($val as $keywords){ echo $val. " - " .$keywords."\n"; } } //output 1 - key1 1 - key2 1 - key3 Any ideas where I'm going wrong, or how this should look? Thanks
  22. ok solved it. Here is the answer for anyone how wants to know: Basically, had to separate all the words and look one by one. $key = $_POST['key']; $ad = $_POST['ad']; $expKey = explode("<br />", nl2br($key)); $expAd = explode("<br />", nl2br($ad)); $a=0; foreach($expAd as $expAds){ $expAd2 = explode(" ", $expAds); $b=0; foreach($expKey as $expKeys){ $expKey2 = explode(" ", $expKeys); for($c=0;$c<count($expKey2);$c++){ if(strpos($expKey2[$c], $expAd2[$a])){ $keyList .= $expKeys; } } $b++; } $keyList .= "\n"; $a++; }
  23. Hi I'm trying to build a system that will allow me to too for a sting with in a string. But, in any order. E.G: hire bartender Will bring back - hire bartender - hire a bartender - bartender hire - bartender for hire - hire bartenders - hire a bartenders - bartenders hire - bartenders for hire Currently, it only returns: - hire bartender - hire bartenders Any ideas? $key = $_POST['key']; $ad = $_POST['ad']; $expKey = explode("<br />", nl2br($key)); $expAd = explode("<br />", nl2br($ad)); foreach($expAd as $expAds){ foreach($expKey as $expKeys){ if(strstr($expKeys, $expAds)){ $keyList .= $expKeys; } } $keyList .= "\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.