I have a classifieds website...
I have Solr doing the searching of the classifieds, and then return ID:nrs which I then use to put into an array. Then I use this array to find any classifieds in a MySql db where the ID:s match the ID:s in the array returned by Solr.
Now, because this array can be very very big (100thousand records or mo...
i am writing two list application where data from one list can be shifted to other list.
i am using DIV like this
<div id="all_users">
<div id="user1" userid="1" class="innertxt"> <img src="images/images.jpg" width="50" height="50"><strong>Test User 01</strong>
<ul>
<li>User ID: 1</li>
<li>Email: u...
Hi there, I'm trying handle bad json data when parsed through json_decode(). I'm using the following script:
if(!json_decode($_POST)) {
echo "bad json data!";
exit;
}
If $_POST equals:
'{ bar: "baz" }'
Then json_decode handles the error fine and spits out "bad json data!";
However, if I set $_POST to something like "invalid dat...
How do you in a simple way get the last key of an array?
...
On my local server, this works fine. However, when I try to do this on the production server, the following returns an empty string:
$tidy = new tidy();
$tidy->repairString($html);
$html has actual HTML content before repairing (I checked), but repairString returns an empty string. Does this indicate a configuration error? Is libtidy ...
When navigating through array with next() and prev(), how could you get the current key the array is at?
...
Hi All,
I am using a foreach loop within PHP similar to this:
foreach ($class->getAttributes() as $attribute) {
// Work
}
Concerning efficiency, is it better to have a $attributes = $class->getAttributes(); statement outside the foreach loop and iterate over the $attributes variable? Or is the $class->getAttributes() statement only g...
Hi alll
I have strings like follow
field_zip_code:"48103"
taxonomy:88 field_zip_code:"48103"
taxonomy:88 field_state:"MI" field_zip_code:"48103"
From here i want to extract variable values like 48103,88,MI
i need regular expressions in PHP,
Thanks in advance
Kamal
...
I have to work with strings which may contain Lat/Long data, like this:
$query = "-33.805789,151.002060";
$query = "-33.805789, 151.002060";
$query = "OVER HERE: -33.805789,151.002060";
For my purposes, the first 2 strings are correct, but the last one isn't. I am trying to figure out a match pattern which would match a lat and long ...
Is there a way for PCRE regular expressions to count how many occurrences of a character it encounters (n), and to stop searching after it has found n occurrences of another character (specifically { and }).
This is to grab code blocks (which may or may not have code blocks nested inside them).
If it makes it simpler, the input will be...
When running a Zend application locally I get Fatal error: Exception thrown without a stack frame in Unknown on line 0, i traced that error to a line $startedCleanly = session_start();
I can't get through it, when I restart the server and reload the page I do not get the error, but on every other reload I get it, I looked into a php/tmp...
I have a PHP script that is sending a series of http requests to another php script on another server. I have Xdebug installed on both servers and I'm using NetBeans as my debug client. The problem I am having is that NetBeans can't have 2 debug sessions at the same time and you can't spawn 2 NetBeans processes on the same machine. A...
I'm trying to extend the SPL ArrayObject but I've hit a little snag. Using an unmodified ArrayObject, this code works:
$a = new ArrayObject();
$a[1][2] = 'abc';
print_r($a);
yielding this output:
ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[1] => Array
(
[...
Hello,
I have been working on facebook application and you know on facebook native javascript is not allowed, they have their own implementation FBJS which is troublesome when it comes to creating stuff like menus.
Is there any pure CSS dropdown solution without any involvement of javascript (javascript is used in all the solutions i h...
I'm trying to make an AJAX form that will update a twitter status when updated. I have the form working currently with php, but am not sure how to add AJAX functionality.
Here's the form:
<form id = "yourwhisper" method = "post" >
<label for="whisper">Enter your status update</label>
<textarea id="whisper" name="whi...
I have following PHP code
$val="<div id=user".$row['cid']." userid=".$row['cid']." class=innertxt><img src=images/images.jpg width=50 height=50><strong>".$uname."</strong><ul> <li>Email: ".$row['cemail']."</li> <li> <input type=checkbox id=select".$row['cid']." value=".$row['cid']." class=selectit /></li> </ul> </div>" ;
$return["fo...
Where is the most secure place to put MySQL database connection details when connecting via a PHP script?
$connection = mysql_connect($hostname, $username, $password);
if (!$connection) {die('Could not connect: ' . mysql_error());}
mysql_select_db($database, $connection);
I know it's not a good idea to put them directly in the script ...
have anyone come across a php code that convert text or doc into pdf ?
it has to follow the same format as the original txt or doc file meaning the line feed as well as new paragraph...
...
I have a php application running on busybox httpd on an ARM-based embedded system. The application is quite slow but I would prefer not to rewrite it in C++. I'm looking for a way to precompile/cache it on ARM but cannot find any of the systems to be available for this architecture.
...
I ran the code in apache localhost and also tried in my host. In both of them, the method moved the file but the file seemed 0kb.
Here is the code:
if(isset($_POST['upload'])){
if($_FILES['profile_foto']['size']>0&&$_FILES['profile_foto']['size']<102400){
$image_extension=explode("/",$_FILES['profile_foto']['type']);
...