The MySQLi feature of PHP is great.
Prepared Statements are great for injecting parameters in a query.
However, if you use Statements, it seems you dont have access to the fetch_assoc feature anymore. You have to manually bind all your results. This mean my SQL query has to list all the fields, then I have to list all the variables in ...
I have a text file that has data wrapped between tags. The tags are:
<title>
<url>
<pubDate>
So, the entries look like this:
<title>title 1</title>
<url>url 1</url>
<pubDate>pubDate 1</pubDate>
<title>title 2</title>
<url>url 2</url>
<pubDate>pubDate 2</pubDate>
<title>title 3</title>
<url>url 3</url>
<pubDate>pubDate 3</pubDa...
Hello!
I wrote this PHP code to implement the Flesch-Kincaid Readability Score as a function:
function readability($text) {
$total_sentences = 1; // one full stop = two sentences => start with 1
$punctuation_marks = array('.', '?', '!', ':');
foreach ($punctuation_marks as $punctuation_mark) {
$total_sentences += su...
I am a beginner in PHP.
I am receiving the following errors. I cannot view the error from my computer on FF, IE, and Chrome, but yet I see the error up top when browsing from another computer's browser.
Warning: session_start() [function.session-start]: open(/tmp/sess_c464nadk4jsn4u43mpqipkjbr7, O_RDWR) failed: Permission denied (13) i...
We can get the files in a directory in PHP by
$files = new DirectoryIterator()
after that is there an easy way to sort the items in a particular order for displaying them? thanks.
...
When a user clicks a submit button I want the form to be submitted. However, just before this happens, I want a window to pop open and for them to fill in some data. Once they do this and they close that child window, I want the POST request to be made.
Is this possible, if so how? I just need help after the window closes, how can I mak...
I have a website form that collects url of users to store in a database. They should not enter the http:// with their URL however many and the result is that when their url is displayed it looks like this
http;//http://www.foo.com I need the form to strip it or ignore it or what ever you think is the best way to handle it.
thanks
...
I have a csv file, which is generated weekly, and loaded into a mysql database. I need to make a report, which will include various statistics on the records imported. The first such statistic is how many records were imported.
I use PHP to interface with the database, and will be using php to generate a page showing such statistics.
...
Here is the input form code
<tr valign="top">
<td align="right" class="innertablestyle"><font class="normal"><strong>Homepage</strong></font></td>
<td> </td>
<td><font class='normal'>http://
<input name="website" type="text" id="website" value="<?php echo $website; ?>">
</font><font class="normal"> </font></td>
...
What's the best in terms of speed and performance? To call the function each time you need the value (e.g mysql_num_rows, time) or to copy the return value to a local variable and use that instead.
Example: Let's say that I call the time() function ten times to get the current time, would it be faster to use a local variable those ten ...
I have thousands of IP addresses of visitors to my site, what tools can I use to convert these into lat/lng coordinates? I will then be able visualise the data on a map with filters for further demographics gathered.
...
I want to do something like this:
class Cls {
function fun($php) {
return 'The rain in Spain.';
}
}
$ar = array(1,2,3);
$instance = new Cls();
print_r(array_map('$instance->fun', $ar));
// ^ this won't work
but the first argument to array_map is supposed to be the name of the function. I want to avoid writing ...
A form I don't have any control over is POSTing data to my PHP script. The form contains checkboxes along these lines:
<input type="checkbox" value="val1" name="option"/>
<input type="checkbox" value="val2" name="option"/>
If I were to write the code for the form, I'd write name="option[]" instead of name="option". But this is not a c...
Hello there, I am trying to convert numerical values written as words into integers. For example,
"iPhone has two hundred and thirty thousand seven hundred and eighty three apps"
would become
"iPhone as 230783 apps"
Before i start coding, I would like to know if any function / code exists for this conversion.
...
Hi. I followed this tutorial:
http://codeigniter.com/wiki/PDF_generation_using_dompdf/
However, I can't seem to set the path right. On the config file of dompdf (config_dompdf.inc.php) I did the following:
define("DOMPDF_DIR", realpath(dirname('./system/plugins/dompdf/')));
I get this error:
Message: require_once(/var/www/myApp/sy...
I heard it is possible to capture webpages by using PHP(maybe above 6.0) on windows server.
I got some sample code and tested. but there are no code to perform rightly.
If you know some right ways to capture webpage save it image file on web applications?
Please teach me.
...
I am making a data entry form in php/mysql. There i have added many dropdowns and auto complete textboxes, which query the database asynchronously and fetch the data. I wanted to inform the user that some kind of interaction between client and server is been taking palce, so i placed an element in hidden form
<div id="wait" style="back...
Hi All
I have a problem with following script. It generates a list of places which are editable, deletable or you can even create a new one.
I want to send a $.post request when creating a new place to a php file which makes an entry into a database (MySQL) and then lists this entryes in html. Now why doesn't even the $.post send an a...
Hi Guys,
Does anyone of you know off by hand what mail headers to add in order to get a read receipt and delivery report? This now being when you use the normal PHP mail function. No fancy add-on script / class like phpMail.
...
PHP keeps failing and telling me that its not finding the /ext/php_mssql.dll for some reason. Obviously, I checked the folder and it is very much there. I'm not sure why it is failing. Any suggestions?
EDIT:
I put the ntwdblib.dll into my php directory and the error that was giving went from "bad gateway. the specified cgi application ...