php

NetBeans IDE for PHP/Ruby.

I just came across NetBeans site and found its PHP and Ruby IDEs. I want to know how popular is NetBeans and are the plugins for SVN really as good as the plugins for Eclipse? ...

Array a string in the following format?

How can i array a string, in the format that $_POST does... kind of, well i have this kind of format coming in: 101=1&2020=2&303=3 (Incase your wondering, its the result of jQuery Sortable Serialize... I want to run an SQL statement to update a field with the RIGHT side of the = sign, where its the left side of the equal sign? I know ...

CakePHP: ACL and/or Auth

My web application only has one level of authorization. It's either you're logged in or not. Would ACL be overkill for this? Would the Auth component be sufficient/secure enough to handle this situation? Does CakePHP session anonymous users? If so, is there a way to turn that off? I don't think I need sessions to be passed around if...

Is object-oriented PHP slow?

I used to use procedural-style PHP. Later, I used to create some classes. Later, I learned Zend Framework and started to program in OOP style. Now my programs are based on my own framework (with elements of cms, but without any design in framework), which is built on the top of the Zend Framework. Now it consists of lots classes. But th...

Regex PHP, pattern matching

Hi i would like to have a regex in php which matches a word in a string but if the word is a link. The problem is that I replace words with links for example: "text" => < a href = "mylink">text< /a>. But sometimes I have the problem that it is replaced twice. So I want to avoid this problem. My pattern now is /text/i. Eg. This is my...

php/mysql: how to search case insentitively

hello, i have this table in UTF8 (collation is utf8_bin in case it matters). I need to search in it for strings using LIKE '%$searchstring%' . Right now you have to use the exact case in order for the results to show up. Is there a way to make it case insensitive ? Thank you UPDATE sorry, found the answer. ...

MySQL add fields to an Enum

I have to add some enum options to a database table. The problem being, I will have to do this to several tables & databases, and they may not all have the same enum data type. Is there a why to write an alter table query or something similar to append options to a enum data type? If there is no way to do this purely in MySQL, how woul...

How do I implement user preferences on a PHP jQuery page?

On a portal's main page, I'm using a jQuery container plug-in, and by this users can hide a container by just clicking the minimize button on a container. My question is: how can I save the user preferences in this regard? Then if the same user logs in again, I want to show the page based on user preferences. For example if a user hide...

Resizing div after iframe change src...

So I automatically resize my iframe based on content height as follows: <iframe name="main" id="main" src="main.php" frameborder=0 scrolling="no" onload="this.style.height = main.document.body.scrollHeight + 5; this.style.width = main.document.body.scrollWidth"> However, I also use a link to change the src (utilizing target if anyone...

Accessing @attribute from SimpleXML

Hi, I am having a problem accessing the @attribute section of my SimpleXML object. When I var_dump the entire object, I get the correct output, and when I var_dump the rest of the object (the nested tags), I get the correct output, but when I follow the docs and var_dump $xml->OFFICE->{'@attributes'}, I get an empty object, despite the...

Tracking and testing for abusive clients in PHP

Now there is a subject that could be taken many ways. Hopefully I will be able to de-obfuscate it as I describe my problem and start getting suggestions. I am developing a site that will be replacing an existing one. Historically one of the problems we have had is spider bots coming in and sucking down all out content. Now we don't m...

PHP pagination script

$string = "This is my page content. This text will be paginated."; $pageNo = "0"; $pieceLength = "12"; $preparedForPrint = substr($string,$pageNo,$pieceLength); what i want to do is if the 12th character is inside a word(the 12th character is not a space) i want to move my cursor 'till it finds a space an return that substring despi...

Displaying Top 25 Table Rows by Timestamp

Hello, The code below lists the top 25 entries (the variable "site") from a MySQL database by "votes_up" in descending order. It works great. Each row has a column called "createddatetime" that is of the following structure: Type: timestamp Default: CURRENT_TIMESTAMP How can I change the code below to show the 25 most recently add...

Drupal 6: Theming a field in views

Basically I want to create a php code in my template (views-view-field--body.tpl.php) that would say the following... if [body] print [node_view] endif ...

Question about output formatting in PHP/XHTML

Is there a way to only print or output 10 elements per row inside a table in PHP from an indexed array with X number of elements of type int. Maybe some function, I have not heard of? Or some technique that's used by professionals or beginners alike. I will embed some code for the TR and TD; however, I was just wondering if there is s...

PHP paginate string problem

i have this script $content = string if(!isset($_GET['page'])){ $page = 1; } else{ $page = $_GET['page']; } while($content[$limit]!= ' '){ $limit++; } print substr($content,($page-1)*$limit, $limit); it works just fine first time (if the page is not set or page number is 1 )but if my page number is greater than 1 it splits my words....

MySQL+PHP: Can anyone tell me what is wrong with this code?

I am having problems running this script, but i keep on getting the same error message. Could someone point out where I am going wrong? Thanks. Error message: 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 '' at line 1 $datenow = date("Y-m-d") . "...

Retrieving the 25 most recently added entries from all tables in a MySQL database

Hello, I have a MySQL database (named "sitefeather") which will eventually have several tables with identical structures. The structure is this: id INT(11) NOT NULL auto_increment, site VARCHAR(1000) NOT NULL, action1 BIGINT(9) NOT NULL, action2 BIGINT(9) NOT NULL, createddatetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(id), ...

Why am I receiving an error when installing PEAR?

I am trying to install PEAR for use with PHP. As i read on the installation instructions at http://pear.php.net/manual/en/installation.getting.php , I am supposed to run the file go-pear.bat which I have in my C:\wamp\bin\php\php5.3.0 directory. According to all the installation guides I have read, it should install and ask me a series o...

PHP - How to check a script version

Hello folks I have a small script and want to detect the script version from admin footer. On the admin footer.php I put this code. <?php define('VERSION', '1.0'); $fp = fopen("http://v.domain.com/version.txt", "r"); while ($line = fgets($fp)) { $line; if (VERSION != $line) { ?> <div id="upgrade"> <a href="http://doma...