I am having a problem with multiple if statements. I am using && but it seems to only work for the first statement. The code is like such: global $post; $args = array( 'post_id' => $post->ID ); $comment = get_comments( $args ); $user = wp_ge
UPDATE ON THE PROBLEM: On some browsers, we have two PHPSESSIDs. One PHPSESSID is not set by me anywhere in my script It has HOST (instead of DOMAIN for the PHPSESSID I set) as www.mywebsite.com I have tried deleting it using setcookie: setcookie ("P
I'm using this to define the valid keys that can be used to perform a search on my front end: $validKeys = array('gender','marital_status', 'age'); The rest of my code works great in that it only accepts keys sent to it in an AJAX call that are in th
I have the following code: $add_rq = $DBH->prepare('INSERT INTO `table` SET `url` = :url ON DUPLICATE KEY UPDATE `url`=`url`'); if($add_rq->execute(['url' => $url])) echo "Added (id: ".$DBH->lastInsertId().")"; else echo &q
I'm using Laravel for a project and want to know how to validate a particular scenario I'm facing. I would like to do this with the native features of Laravel if this is possible? I have a form which has two questions (as dropdowns), for which both t
I realise this has been asked a myriad of times in the past - though I have looked through 4 or 5 of these threads and for the life of me I cannot figure out what is causing my form to redirect! Please help! Here is my form submission function: Every
Thats the code i use: HTML: <form id="ajax-contact" method="post" action="mailer.php"> <div class="field"> <label for="name">Name:</label> <input type="text" id="n
I am working on making a PHP and MySQL application for practicing my new-found love for programming. I have a login script; the HTML form is as follows: <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post"
I'm using twitter api to retrieve fav tweets, then parse them using a template: $favs_list = $this->connection->get('favorites/list'); $data_to_parse['fav_list'] = $fav_list; $html = $this->parser->parse('templates/tweet_list', $data_to_parse,
This is the code. I wanted my website login system. As a member successfully logins (variable login) returns true if not returns false. When I insert this code *When user login was incorrect it shows the code for Successful login. Always it pretend t
I need to create truly unique token when inserting records in CakePHP. The table can contain millions of rows so I cant just base on some randomly generated strings. I do not want to use a microtime() as well, because there is, though very small prob
I am trying to find the highest number in a column out of several results, I am trying to use the following code but it isn't working as expected. If I have records numbered 1 to 7 I want to pick 7 as it has the highest number. if (isset($_GET['quest
So here's the problem that I am facing : I have created a blog system in Yii and I have created a comments creation form in the Post view page. I have also created a delete link, and the link is working fine and the comment is indeed getting deleted
I need ImageMagick on PHP 5.4. Windows, both Apache and IIS7. I've downloaded ImageMagick-6.8.1-9-Q16-x86-dll.exe and http://valokuva.org/~mikko/imagick-php54-php53.tgz But I get an error upon Apache restart: PHP.EXE NO ENTRY POINT FOUND: The procedu
Just a quickie, I have a date in my database where a subscription to a service starts... In your experience, do you think it's better to record the expiration period as a time.. so then i can add the time onto the date_created to see if it has expire
I have a script that lets me replace values in my database. When I use this: $search = ("\\"); $sql[$handle]['sql'] = 'UPDATE '.$table.' SET '.$field.' = REPLACE('.$field.',\''.$search[$i].'\',\''.$replace[$i].'\')'; I get the following error:
Really poor at regular expressions, sorry in advance! I've tried my best to work out how to split a string into a array with two delimiters and still capture one and include it in the final array. preg_split seems ideal for this but my regular expres
I'm using HTMLPurifier to sanitize HTML string (it's about security). Some attributes (like width or height) are removed when HTMLPurifier is called. I don't consider this as a security issue. How can I add this attribute without redefining the white
a website has used a "301 permanent redirect" to my site is there a way i can set code that detects this and displays a page when my website is accessed through this? Does anyone have any idea about this?You can get only a referer. I think you w
I'm looking to replace all instances of spaces in urls with %20. How would I do that with regex? Thank you!No need for a regex here, if you just want to replace a piece of string by another: using str_replace() should be more than enough : $new = str
I am trying to turn a php mysql statement into Codeigniter syntax. The code selects all from a db but the zone difference equals to two form inputs subtracted from each other. Any help is much appreciated. PHP Version select * from zone_cost where zo
How to check whether a variable $date contains a date in the form of 2011-09-20 ? This is to know if the $date contains any letters in it because I want to use the date() and gives me error.try this: $date = '2011-09-20'; list($y, $m, $d) = explode("
I hate to type the INSERT query, you always miss out with some stuff, and get syntax error. Therefor, I want to create my own function, to let me do this. This is what I got so far: $data['test'] = array('username' => 'john', 'password' => 'hello',
I've recently attempted to install mysql on my mac - osx lion. I followed this guide - http://matthom.com/archive/2009/06/14/installing-mysql-mac-os-x I can't seem to create a database from terminal, so I assume I've done something wrong in my instal
How do I use UNION ALL in this fashion in Zend Framework? (select id from astrology where commu_time_from <= '11:51' and commu_time_to >= '11:51' and user_id=1 and appo_date='03/01/2017') union all (select id from facereading where commu_time_from &
$im = new Imagick($path); $im->resizeImage(); echo $im->calc_image_size(); ? //> 121312 Bytes Is there a calc_image_size or I have to write in a file and check the dimension? (fail)getImageSize throws a Deprecated. Imagick::getImageSize is deprec
I'm trying to write a script that will show the rss version of a single url (title, author, image, source, etc..). This should behave much the way that facebook does when you copy paste a link to share and it generates this information automatically.
I googled a lot, for those kind of problems have been asked a lot in the past. But I didn't find anything to match my needs. I have a html formatted text from a form. Just like this: Hey, I am just some kind of <strong>formatted</strong> text!
I am modifying a core function of the Kohana library, the text::auto_p() function. The function describes itself as "nl2br() on steroids". Essentially, it provides <br /> single line breaks, but double line breaks are surrounded with the &