Hi,
I've recently written a javascript RegExp to cleanse my data at the front end, I now need to do exactly the same for my PHP back end but not having worked in PHP for a while I'm having trouble. Below is the javascript RegExp, can someone please help me convert this to PHP?
var illegalChars = /[\(\)\<\>\,\;\:\.\~\@\#\$\!\%\^\&\*\'\?...
There are a few hundred of book records in the database and each record has a publish time. In the homepage of the website, I am required to write some codes to randomly pick 10 books and put them there. The requirement is that newer books need to have higher chances of getting displayed.
Since the time is an integer, I am thinking like...
Anyone know of any Flash components that would do the job of displaying an external PowerPoint file (e.g. .PPT, .PPTX) file in a Flash movie on a web page? Or a way of automatically parsing uploaded PowerPoint docs from a PHP-based CMS and displaying them on a web page.
Our client needs to be able to upload a PowerPoint documents on the...
Even though its obnoxious in a lot of ways I use PHPMyAdmin all the time to debug database issues while writing PHP. By default it sorts tables by primary key ascending. 99% of the time I would rather have the newest data (my test data) shown at the top by default rather than the useless first few records ever saved.
Is there a way to ...
Hi,
I am executing a php call from javascript(jQuery), php sript is sending result back. The problem is that these php scripts are taking some time (milliseconds), and java script is not waiting for them to finish, thus variables are not getting initialized with correct values.
The code is simple:
$.get("php/validation.php",{'email':em...
Hi,
I have a MS SQL query that is selecting a field and it is being chopped off for some reason it is cutting off text at 257 characters.
Is there some kind of default cut-off for retrieving results with MSSQL and PHP?
I'm honestly clueless as to why this is happening. ANY guidance would be greatly appreciated
The field type is "cha...
Hi
I have this code for example :
$b = "";
while ($row = mysql_fetch_array($rows)) {
if ($row['enabled'] == 1) {
$b = "checked";
} else {
$b = "":
}
echo "<\input name='nam[$row[id]]' type='checkbox' value='$row[id]' $b />";
}
When I execute this c...
i use nicEdit to write RTF data in my CMS. The problem is that it generates strings like this:
hello first line<br><br />this is a second line<br />this is a 3rd line
since this is for a news site, i much prefer the final html to be like this:
<p>hello first line</p><p>this is a second line<br />this is a 3rd line</p>
so my current...
SO I am trying to make a restful api system with symfony and I am a little confused about something. So every different route gets sent to a different action method to be handled, however, many different actions display the same sort of data (list of users or a list of groups). I don't want to have to have redundant templates just becaus...
Looking for built in encryption functions, not to hide the string from the clever programmer, but instead just to obfuscate it a bit. Looking for functions such as str_rot13 and base64_encode, but I can't seem to locate any. Surely there are more?
...
I need to remove all special characters and spaces on a textfield for a form I'm building. How do I accomplish this in PHP.
...
Can someone point me in the right direction in regards to making an api use basic http authentication?
I am creating a restful api with symfony but would like to require users to be logged in to get certain data. I would also like many of these methods be dependent on the the username in the authentication process in order to get some ...
Hello, i have a php who when is executed it give me a couple of vars in this format:
&lVar1=DATA1&&lVar2=DATA2&&lVar3=DATA3 and soo...
The problem is that i dont know the quantity of lVar the php script is gonna give in any time, so i cant figure out a smart script in AS2 to import all of them into a array to my flash. Can you help me?...
I am currently exporting Drupal data to an external source (XML) programmatically. However, I want the data to run through the site's default Input Format (the filter that runs before user content is displayed on the website) before being written to file.
How do I programmatically apply a Drupal input filter? Is there a specific functio...
<?php
$data = array('name' => 'Ross', 'php_master' => true);
$url="http://localhost/test.php";
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
curl_exec($handle);
?>
The $_POST variable on the server side is empty. I also tried using Java servlet; request.getParame...
Hi all,
I'm using jQuery to post HTTP requests to my PHP page (Apache/Linux, if that matters). I carefully validate on the client so that empty requests are not sent. However on occasions, I'd get an empty request like this:
- $_POST collection empty ($_GET collection also empty);
- Content-Length is nonzero (a number below 100, consi...
I'm experimenting with transactions for the first time in mySQL.
I am wondering if it is safe to use mysqli_multi_query for this purpose. That is, can I assume that if any of the SQL statements fails, everything will be rolled back?
$query = "
START TRANSACTION;
(a bunch of SQL statements)
COMMIT;
";
...
You can easily get an array value from a key like so $value = array[$key] but if I have the value, and I want the key, whats the bet way to get it?
...
Hello all,
I was just helped with this question but I can't get it to move to the next block of HTML.
$html = file_get_html('http://music.banadir24.com/singer/aasha_abdoo/247.html');
$urls = $html->find('table[width=100%] table tr');
foreach($urls as $url){
$song_name = $url->children(2)->plaintext;
$url = $url->children(...
Hi, I'm using the a wrapper around the PHP5-class DOMDocument to generate my HTML. This makes it easy to modify the HTML by using the DOM.
An example is creating element #1 and adding it to the element #2 and still be able to modify element #1 directly.
A problem arises however with the following:
Element #1 is added to element #2
El...