Jump to content

DHood

Members
  • Posts

    15
  • Joined

  • Last visited

DHood's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm attempting to take a string and find/replace all the hashtags into links. This works except it messes up the html in the string, I want to ignore all html entirely. #testing <span style="color: #bbbbbb">#asdfasd</span> #test Right now using this: $string = preg_replace_callback('/#([a-zA-Z_]+)/', array($this, 'renderHashTag'), $string); #testing, #bbbbbb, #asdfasd, and #test all get picked up and I don't want #bbbbbb or #asdfasd to. I've tried several different things before posting here, I just can't seem to figure out how to ignore the html tags, someone recommended removing them but I don't want to do that as some of it may be important to the styling.
  2. DHood

    Sub Queries

    I take it I have to do this as two separate queries since I want both? I want the results of the query, but then I want to count how many would be results if I added "and field='Yes'"
  3. DHood

    Sub Queries

    That's nearly what I want, however since I'm also displaying a list of results it's just making the counts 1 for each row. I want the sum of all rows with that match.
  4. DHood

    Sub Queries

    Sorry, I probably could have been more clear. I'm not looking to return the results. I just want the count as if that were the query. I want to display the results of SELECT * FROM table WHERE name LIKE '%test%' and on the side bar show the number of row for SELECT * FROM table WHERE name LIKE '%test%' and sms = 'Yes' next to "SMS" and then SELECT * FROM table WHERE name LIKE '%test%' and email = 'Yes' number of results next to email. Is it possible to do this with one query or do I need to run 3 different ones? I was looking for a way to do one query because there's actually like 8 of these that I want to run.
  5. DHood

    Sub Queries

    I'm attempting to make a table of mine searchable. I have 4 fields, name, web, email, sms. I intend to have a sidebar with links to filter the results with like web=Yes, email=Yes, sms=Yes. I want to next to the links show the amount of results that would be returned if the current query had that parameter added. So lets say I'm at q=Test it'd be searching "SELECT * FROM table WHERE name LIKE '%test%'" I want to be able to return a count of results for "SELECT * FROM table WHERE name LIKE '%test%' and sms = 'Yes'" and "SELECT * FROM table WHERE name LIKE '%test%' and email = 'Yes'" without running two new queries.
  6. class MyClass { public $variable; public function setVariable($value) { $this->variable = $value; } public function getVariable($variable) { var_dump($this->variable); var_dump($variable); } } $test = new MyClass; $test->setVariable('test'); $test->getVariable(); Using setVariable like Psycho suggested, you'll see why you need to assign it to $this.
  7. $db_fields isn't defined within your database class.
  8. For the redirect part of it use header('location: /path/to/redirect.html');
  9. More specific to your initial post though (and sorry for the double post). If you were using it with your function you would do something like: if (attach_file($file)) { echo "Success!"; } else { echo "There was an error attaching your file."; }
  10. The point of returning true and false is for checks. Basically you can do things like function isLogged($var) { if ($var == 'foo') { return true; } else { return false; } } and then you can do: if (isLogged('foo')) { echo 'Was logged.'; } else { echo 'Not logged'; } If you change the foo in the if statement to something else (outside the function), it'll say not logged because the if statement is getting a false return. As they said, you may see similar functionality between returning false and returning nothing due to how php is done.
  11. DHood

    SOAP Help

    I tried it with an empty array and it's still erroring, do I need to maybe change it to an object instead of an array?
  12. DHood

    SOAP Help

    Thanks. If it's supposed to be an empty array, how am I suppose to populate the fields? [EDIT] Nevermind, I thought you were talking about the required field not the optional, Read it too quickly.
  13. I'm attempting to work with an api that uses soap connections. I keep getting SoapFault Object ( [message:protected] => Server was unable to process request. --> Object reference not set to an instance of an object. This error. My code is $ns = "http://www.fastcash4homes.com/WS/LeadSubmission.asmx?WSDL"; $soapClient = new SoapClient("http://www.fastcash4homes.com/WS/LeadSubmission.asmx?WSDL"); $headers = array(); $headers[] = new SoapHeader('NAMESPACE', 'Content-Type', 'text/xml; charset=utf-8'); $headers[] = new SoapHeader('NAMESPACE', 'SOAPAction', 'http://www.fastcash4homes.com/WS/LeadSubmission.asmx/SubmitMinimalFullSellerLead'); // Prepare Soap Client $soapClient->__setSoapHeaders($headers); $array = array( 'FirstName' => 'firstname', 'LastName' => 'lastname', 'PrimaryPhone' => '9995554444', 'Email' => 'Email@ext.com', 'Address' => '123 Address St', 'Zip' => '12345', 'Bedrooms' => '2', 'Bathrooms' => '2', 'AskingPrice' => '50000', 'IsCurrentlyListed' => 'No' ); // Call RemoteFunction () $error = 0; try { print_r($soapClient); $info = $soapClient->__call("SubmitMinimalFullSellerLead", array('UserID' => 'UserID', 'Password' => 'Password', 'LeadData_Required' => $array, 'LeadData_Optional' => '')); } catch (SoapFault $fault) { print_r($fault); die; } I've tried a variety of different arrays in $soapClient->__call (which is the line erroring by the way). Any help is appreciated.
  14. I'm attempting to email a newsletter that is html based. I have the code working 100% when accessing it directly via the .html file but when I email it, there's a bunch of random spacing. I tried adding style='display:block;margin:0;padding:0;' to all the images, which improved it some, but not too much.
×
×
  • 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.