Multiple if statements are issued

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

How to remove PHPSESSID on client computers

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 I have tried deleting it using setcookie: setcookie ("P

PHP / mySQL gets all the column names and creates a list

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

e.preventDefault does not stop the redirect on the form

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

PHP AJAX form sending problems

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

PHP form validation showing errors before submitting

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"

Login account account error system

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

Single token in CakePHP

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

Find the highest number in a column

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

Can not get actionDelete () to redirect correctly in Yii:

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

Installing ImageMagick on Win / PHP 5.4

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 But I get an error upon Apache restart: PHP.EXE NO ENTRY POINT FOUND: The procedu

Subscriptions and MySQL database structure

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

Backslash in Replacement Statement - Syntax Error

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:

PHP preg_split with two delimiters and capture a single

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

301 Permanent Redirection

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

Use PHP Replace spaces in URLs with% 20

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

How to check if a variable contains a date or a date and text?

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("

Improve this php insertion class function

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',

mysql installation problems - mac osx

I've recently attempted to install mysql on my mac - osx lion. I followed this guide - I can't seem to create a database from terminal, so I assume I've done something wrong in my instal

javascript switches based on php header get value?

I have two links which show / hide div sections (inside each div section i am running sql queries) <li><a href="javascript:toggle('subscription')"><b>Subscription Details</b></a></li> <li><a href=&quo

PHP Zend Framework - How to use union all?

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 &

Imagine knowing the size of the image? (file size)

$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

How to view the rss version of a news link

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.

PHP: Filter html tags specific to a given text

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!

Help with a regex that removes the main white space

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 &