php

PHP Command-line script exits on false

I am running a loop script in PHP command line, which send out emails to customers using PHPMailer. The problem I am receiving is that the command line script exits when the PHPMailer returns a false. Here is the script pseudocode: while(the loop is valid){ if(mail ID exists){ set_time_limit(30); ..compose mail.. ...

Reg exp for youtube link

In a system that I'm developing I need to recognize the youtube link in the following format [youtube]youtube url[/youtube] for the moment I arrived at this regular expression: #\[youtube\]http://www.youtube\.(.*)/watch\?v=([a-zA-Z0-9_-]*)\[\/youtube\]#s But this pattern isn't able to recognize url like [youtube]http://www.y...

How add new line after four looping in smarty templates

i want to add new line after four looping. i using {section loop=$arrProducts name=index} when execute array will show all products in one line but i want to add every four products in line. what can i do??? Thank You this code i use {if $arrProducts neq " "} {section loop=$arrPro...

calling a method from another method in same PHP class

Hi, I'm trying to use a method from within another method in a class. I don't have much experience in PHP5 OOP, and I looked around for answers, but couldn't find any. I'm trying to use getClientInfo() in sendRequest(), which is in the same class. class DomainHandler { public static function getClientInfo($db, $client_id) { ...

Country/City/state validation

I want to do the following things using PHP and jQuery https://www.careerbuilder.com/share/register.aspx?sc_cmp1=JS_LoginASPX_RegNow Steps Select a country from a dropdown list. The city dropdown list will fillup automatically with the list of cities of the selected country. If state is available for that country then state list wil...

short php syntax error, help...

I have this in php code: $display_table .= " - $row[year]"; Works fine! But when I try it with another row, it wont work: $display_table .= " - $row[1_year]"; // DOESN'T WORK I have tried quotes and double quotes without luck. Any help? Thanks ...

How to convert a multidimensional to a nested array from several tables in PHP ?

Hello, I want to make a multidimensional array in php. Here is what i have done: Firstly, i have 3 tables: entreprise: enterprise_id name 1 e1 2 e2 site: site_id entreprise_id name 1 1 e1_site1 2 ...

Url parsing and simplification in PHP

I'm parsing the links found on webpages, and I'm looking for a way to convert URLs like this: http://www.site.com/./eng/.././disclaimer/index.htm to the equivalent and more correct http://www.site.com/disclaimer/index.htm mainly for avoiding duplicates. Thank you. ...

get number in front of 'underscore' with php...

I have this: 15_some_text_or_numbers; I want to get whats in front of the first underscore. There is always a letter directly after the first underscore. example: 14_hello_world = 14 Result is the number 14! Thanks ...

PHP functions wont work with String object, but works with it typed manually

Hi, I'm trying to strip tags from a text output coming from an object. The problem is, that I can't. If I type it manually like "<p>http://www.mylink.com&lt;/p&gt;", it works fine! When doing echo $item->text; it gives me the same string "<p>http://www.mylink.com&lt;/p&gt;"; Doing var_dump or even gettype, gives me a string(). So, I'm s...

Jquery Onclick doesnt seem to work for me...

My php page uses sequence of three radio buttons and two out of three calls jquery click event and toggles a div accordingly... Here is my Jquery function.... $(function() { $("#click_here").click(function(event) { event.preventDefault(); $("#div1").slideToggle(); }); $("#div1 a").click(function(event) { event.p...

jquery auto refresh script problem

hey guys i wrote myself a block of jquery codes to auto refresh a div just want it to reload every 10 seconds . but problem is after the time i specified in my code script going crazy reload every second <script> var auto_refresh = setInterval(function(){ $(\'#showDIV\').slideUp(\'300\').load(\'movies.php\').slideDown(500);},...

How do I use e-mail addresses as user names in Joomla?

I'm developing a web site with Joomla, and I want to use an e-mail address as a user name. I tried to edit default.php and controller.php in com_user/register directory but that didn't work. Any other ideas? ...

MySql query cache settings

How can I set the query cache of MySql? My "my.ini" file doesn't contain the variable mysql_query_type or mysql_query_size at all... How are these set? Can they be set from PHP? Thanks ...

Where is the file located in Load Data Infile?

If I use a Load Data Infile MySQL query in PHP, where is the file location relative to? Is it the same folder as the PHP file? ...

Setting A Default Variable Value In The Construct Of A PHP Class

I'm having difficulties in setting the values of a private variable in the construct of a class i'm working on... Can anyone spot where i'm going wrong? function __contruct($brokerId){ parent::__contstruct($brokerId); $this->_coverSummaryPoints = array('option1' => array('bullet point 1', ...

how to store and search mp3 by its content.

I want to store multiple mp3 files and search them by giving some part of song, to detect which song it is. I am thinking of storing all binary content in mysql and when I want to search for a specific song by content I will take some middle portion of song and actually match it with the binary data in MySQL. My questions are: Is thi...

How to verify a datatype mismatch? (not=== false)

What's the opposite of triple equals matching in PHP? $mail_01 = filter_var($mail_01, FILTER_VALIDATE_EMAIL); if($mail !== false){ echo "Email address required"; } Is the !== usage correct? Thanks for any help. ...

Post and submit problems using javascript, forms and php

Hello, I am trying to create a validate-email javascript and get it working with forms and PHP. Of coures, some problems... As you can see in my form, I did define "post" as the method. But I can only retreive the data as if it was a get method. It was working before I started to add the e-mail verification script and adopt the code t...

PHP - how to flip the rows and columns of a 2D array

Normally I'd be asking how to turn something like this: 1 2 3 4 5 6 7 8 9 10 11 12 Into this: 1 4 7 10 2 5 8 11 3 6 9 12 But actually I want to turn it into this: 1 5 9 2 6 10 3 7 11 4 8 12 In other words, I want to flip the rows and columns, but keep...