php

Setting variable equal to count of a field in database table

Hello, For the query below, I would like to set a variable called $totalcount equal to the count of all loginids in table called login. How can I do this? Thanks in advance, John $sqlStrcount = "SELECT loginid FROM login"; ...

Searching keywords(from a matrix) in a string(around 500 char)

Hey, basically what i am trying to do is automatically assign Tags to a user input string. Now i have 5 tags to be assigned. Each tag will have around 10 keywords. A String can only be assigned one tag. In order to assign tag to string, i need to search for words matching keywords for all the five tags. Example: TAGS: Keywords Drink...

remove session id from url

Hi! I want to develope simple web crawler, to grabb pages from several web sites and maintain them in actual condition. Some of this sites has session ids on each link, they doesn't store sesion ids in cookies at all. So, if i will parse site several times - my parsing table will containts dublicate pages with difference only in session...

how to remove new lines and returns from php string?

A php variable contains the following string: <p>text</p> <p>text2</p> <ul> <li>item1</li> <li>item2</li> </ul> I want to remove all the new line characters in this string so the string will look like this: <p>text</p><p>text2><ul><li>item1</li><li>item2</li></ul> I've tried the following without success: str_replace('\n', '', $st...

using CMS to open page

this is the index.php <table align="center" border="0" cellpadding="0" cellspacing="0"> <tbody> <?php include 'header.php'; ?> <tr> <td class="row_2"> <!-- header_eof //--> <!-- body //--> <table class="main_table" border="0" cellpadding="0" cellspacing="0"> ...

openID component for cakePHP (and an easy way to Google)?

I have integrated the openID component for cakePHP from http://code.42dh.com/openid/ into my application. When I put in my openID URL (http://openid-provider.appspot.com/XXXXXXXXX ) I am prompted to log into Google from the openID page which and I get properly redirected back to my page with a whole lot of stuff in the GET string and a "...

Zend Framework, HelperBroker PHPUnit Test

Hello, This is a very specific question and I have googled lots for a potential solution but nothing that points me in the right direction. I have written a Zend_Controller_Action_Helper to help me process some forms in my application. Now in the application it works fine but it seams to of broke my tests. If I comment out the lines ...

Export sqlite table using php

Hi, Im just getting started with PHP, and I need to export a table from my sqlite database to a CSV or ideally XLS. I have found an example using mysql, but i cant convert it to work with sqlite. Here is what i have so far: <?php $db = new PDO('sqlite:../ccm.sqlite'); $query = $db->query('SELECT * FROM Emails'); $export = sqlite...

Which MQ implementation would be suitable

Hi I have to implement Message Queue on site which do 20K/Day write operation in Database. We are willing to introduce message queues to take load off these write operations. I dont know much about Message Queue Implementation. If we implement it on one server only will it be helpful? or suggest some better impentation. Also which MQ t...

distance calculations in mysql queries

I have to query a database of thousands of entries and order this by the distance from a specified point. The issue is that each entry has a latitude and longitude and I would need to retrieve each entry to calculate its distance. With a large database, I don't want to retrieve each row, this may take some time. Is there any way to bui...

Run PHP scripts stored inside Rails directory structure

Hello, I built a PHP application using Drupal and I want it to run under the same domain where Rails is running. So for example I have mysite.com running on Ruby on Rails, I would like to install and run Drupal in mysite.com/my_drupal_application. I tried creating a subfolder inside rails , on the same level as apps and models directo...

jqgrid: get value from json data

hi, how can I get return value from json string? how can I parse and read the variable searchxx? from php: $responce->page = $page; $responce->total = $total_pages; $responce->records = $BC->tot_count; $responce->searchxx = $sSchWhere; $responce->order = $sOrder; while ($data) ...... echo json_encode($responce); fro...

phpmyadmin alternative (ajax, excel-like)

(if i searched for "phpmyadmin and excel", i get answers like "hot wo import excel-files"....) i searched for a phpmyadmin-alternative that works faster with ajax and i want to edit once fields directly like EXCEL! click n edit via ajax!! i dont like to click the row and say "now edit", then edit, and click "ok", return and new loading t...

Hover effect using JQuery

Hey friends i need to know how we can do the following? like i am having the following links client 1 client 2 client 3 client 4 client 5 while i place my mouse pointer over client 1 under the client 1,the following should be show as edit/Replace/Delete.same as client2,client 3,client 4.and client 5 how can we do this? Update: While ...

How to install eclipse for java developer,c/c++ developer, php developer at the same time?

Now I am trying to install eclipse on my computer under Windows 7. The problem is how to install the eclipse for java,c/c++,php,javascript concurrently? Would donwloading the four zip files and then unziping them all into one directly say d:\eclipse works? Is there any good tutorials for installation/configuration of eclipse? ...

to catch curl error in php

I am using PHP's Curl functions to post data to the web server from my local machine. the code that i am using, $c = curl_init(); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_RETURNTRANSFER,true); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $data); $result=curl_exec ($c); if(curl...

when captcha is wrong form data is lost

I have form for my word press website which user can enter some information. In my form I have captcha image which user has enter manually. The problem is when user enters wrong captcha the form data which he filled also losing. Is there is any way to refresh the captcha with out losing the form data? Help me out... Thanks in advance... ...

How many database instances are too much with the ezcomponents database component?

Hi, I want to connect to about 9 databases and create an instance for everyone of them to aggregate my results in the queries. I am writing a metrics dashboard for my company that need to track results and performance over about 9 different databases with about 15mil+ records in each. Now the technical part is not hard. I know how to c...

help simplifying function that adds and increments "image[]" into a array

I've been working a lot with forms lately and decided to make a php script to simplify some aspects that I see myself repeating, I won't post the full monstrosity that I have created, but instead I will ask you to help me simplify the following code if possible: function add($name,$input,&$array) { $p = explode('[',$name); if(isset($p...

javascript equivalent of php $$ dollar dollar

Hi, I have declared a local variable named cont in a function named validate. I am calling a function process from inside validate. I am sending the string 'cont' as argument to validate function. In the process function using the string 'cont' i want to access the javascript local variable's value like window['cont']. But i get undefi...