php

Current Server Status

I know that I have seen a method out there in PHP that when called will give me the current CPU status, but I cannot remember it, and google searches are not coming up with anything for me. Basically, I have a chat program, and I need to make sure that it doesn't wreak havoc on the server. So I would like to, when a message is posted (...

What will you do to optimize MySQL performance in this case?

$query = "select * from a ..."; if($result = mysql_query($query,$con)) {while($row = mysql_fetch_array($result);) $arr[0][] = $row; } $query = "select * from b ..."; if($result = mysql_query($query,$con)) { while($row = mysql_fetch_array($result);) $arr[1][] = $row; } $query = "select * from c ..."; if($result = mysql_query($query,$...

how to remove html tags and php serialization info from mysql result without php?

I'm storing a PHP array where key=>value pairs are information used to build jQuery UI tabs on a website. The string stored in the MySQL database looks like: a:2:{i:0;a:2:{i:1;s:9:"Info";i:2;s:643:"<h2><strong>This section is about foo</strong></h2><p><strong>Lorem ipsum ...";}i:1;a:2:{i:1;s:14:"More Info";i:2;s:465:"<p>Lorem ipsum ......

PHP, SQL newbie help

I have the following table: Comments -------- id PK cid content uid comment If the content is image /i want it to print ?imgID=$cid and get the data from the row title from the table images and if it's a thread I want it to print ?threadID=$cid and get the title from the table threads and so on. How should I do this? <h3...

Manipulating Dates in PHP without using Regular Expressions

Is there a way to change a date from 1985-12-15 to 1985-12 without using a regular Expression? ...

Find all second level keys in multi-dimensional array in php

I want to generate a list of the second level of keys used. Each record does not contain all of the same keys. But I need to know what all of the keys are. array_keys() doesn't work, it only returns a list of numbers. Essentially the output Im looking for is: action, id, validate, Base, Ebase, Ftype, Qty, Type, Label, Unit I have a la...

Create discount system in php

Hi all,i want to ask..Does anyone ever before create a discount system with php for ecommerce. I.e : Before discount,the price was $100,after discount the price become $85,and the $100 was stroked..Thanks.. ...

Dynamic Navigation in CodeIgniter

I'm looking at the demo videos at the CodeIgniter site and browsing through the documentation but its is unclear to my how I can achieve dynamic navigation from one page to another, depending on user input. For example I'd like to have a login form that will either forward to a "success page" or a "login failed page". Where should I p...

Is it necessary to create a "SOAP server" instance?

I am using the nusoap lib with a cakephp app for legacy / compatibility reasons, I was just wondering if it was totally necessary to create an instance of nusoap_server, I can't figure out any obvious reason for doing this when i can just output any data formatted as xml nilly willy without creating a server instance - is it perhaps just...

Can someone show me how I can let a member add their own tags to a question using PHP?

What I mean is that I want logged in members to add their own tags to any given question they see fit. So far, I have got the following script that calls the tags entered into the database which is below. <?php function tag_info() { $result = mysql_query("SELECT * FROM tags GROUP BY tag ORDER BY count DESC"); while($row = mysql_fet...

how to run a batch file in php under xampp on windows

I'm trying to write a little php to update an svn repo on a server running xampplite under windows. (This is a development server, not a production one.) Here's my php: <?php passthru("update.bat"); // I also tried exec() & putting the svn command in directly ?> update.bat is sitting in the same folder as the php script Here's the ...

Drawbacks of PHP-on-IIS?

I work in a dev environment that is currently IIS6/Server 2003 with Framework 3.5. I primarily am working in ASP.NET MVC. I've run into a scenario where, for the solution I'm working on, I'd either have to spend weeks reinventing the wheel or integrating a PHP-based opensource project into one of the components I'm building. I'd love ...

XDebug trace gui?

Hey, I'm trying to find a gui to parse xdebug trace files. Although you can make them human readable, the sheer number of lines makes it unusable. I'm looking for something like kcachegrind but for a trace file. My main goal behind all this is to find what the memory hogs are. Thanks! ...

Need a php and mysql tutorial that shows you how to upload info to a databse?

Can anyone show me or point me to a tutorial that shows me how to upload info like an article to a mysql database using php. ...

mysql error when comparing date (php)

I am not sure why this i get this mysql error. Originally i didnt have '' around the date. Then i tried ''' and '`' without any luck. Whats wrong? SELECT COUNT(user) WHERE user=1 AND pass_time<'2009-09-21 13:44:38'; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right synta...

What do I put in the config.xml file to override linkAction in Downloadable (Magento controller)?

I'm trying to override the linkAction method so that I can serve up downloadables in S3, etc. ...

Need help adding a bookmark to Delicious using cURL

I'm trying to write a class that can add a bookmark to my Delicious account. Here's my method: public function addBookmark($url, $description) { $dusername = 'myUsername'; $dpassword = 'myPassword'; $api = 'api.del.icio.us/v1'; $link = urlencode($url); $desc = urlencode($description); $apicall = "https://$dusername:$d...

Counting the same word that a user enters from a form with Mysql and PHP?

I was wondering if some one enters a word into a database from a php form how can you count how many people have entered that same word in the database as well as how not to create a whole unique id for that same word just a count for that same word when the user enters the same word. ...

What is the best way of displaying items close to someone on a page using php

Basically, I want to display local events to people on a page. So if you were from California you would have different things than someone from Florida. I am going to be using php for the rest of the project so php is a must. I would prefer to get the data without having to ask the user for additional information. IF I have to ask fo...

How do I fix default CakePHP routing on a "baked" MVC?

I just set up a database according to CakePHP's conventions, ran the "bake" scripts for models, controllers and views, and made sure the path was set up correctly. When I go to the following style of URL: http://BASEURL/app/controller_name I get the expected list view for that controller, but all the links generated by baked pages ar...