I have large text files 140k or larger full of paragraphs of text and need to insert a sentence in to this file at random intervals only if the file contains more then 200 words.
The sentence I need to insert randomly throughout the larger document is 10 words long.
I have full control over the server running my LAMP site so I can use...
How does PHP read if statements?
I have the following if statements in this order
if ( $number_of_figures_in_email < 6) {
-- cut: gives false
}
if($number_of_emails > 0) {
-- cut: gives false
}
if ( $number_of_emails == 0) {
-- cut: gives true
...
<?php include("admin/db.php");
$recipients = "SELECT * FROM recipients ORDER BY id DESC";
$email_list = $db->query($recipients);
foreach($email_list as $row) {
echo $row['email'].",";
}
$to = "?";
?>
Above I have a comma delimitated list of emails which I need to insert into the $to variable. How do I do this?
...
I am working on a website which the good user inputs a website domain name, http://www.mysite.com.
But I have been reading about remote file inclusion (RFI), and it is pretty interesting. Simply by adding ?page=http://www.mysite.com/index.php? or something near that I get some type of error (500).
Other peoples sites using wordpress/ PH...
Hey there!
I want to simply not use ampersand in my URL so I can pass ampersands further down into my system when a file is requested. The problem is Apache deals with it differently. I don't know how
I already rewrite the requested file to index.php?url=$1 so I can see what it was, but if it has an ampersand in there, it can't continu...
Hi guys - I have a simple script which inserts values from a text file into a mysqldatabase - however some accented characters aren't inserted properly. Like lets say I have a word:
Reykjavík
I try to insert it using a simple insert sql statement and instead I this value ends up in the database????
ReykjavÃk
How do I fix this?
====...
What is the difference between the quotes " and ' ? What about `? Is there an error in using different quotes ' and " below?
$result = pg_query_params($dbconn,
'INSERT INTO users
(username, email, passhash_md5)
VALUES ($1, $2, $3)',
array($username, $email, $passhash_md5
)
$result = pg_query_p...
I've written my own model to handle authentication but I was just wondering how I would go about implementing a 'Remember Me' function?
To log in a user I simply set the following userdata: UserID(int), LoggedIn(bool)
...
Hi!
In a single script, I need to do the following:
create a zip out of files in a directory
force the download of the newly create zip
My problem is that whenever I try to do this in a single script,
the downloaded zip is corrupted (filesize is ok though). If I trig the
processes in two separate script calls, the downloaded zip is ...
Hi,
A friend told me that I should include the table name in the field name of the same table, I wondering why? And should it be like this?
Example:
(Table) Users
(Fields) user_id, username, passowrd, last_login_time
I see that the prefix 'user_' is meaningless since I know it's already it's for a user. But I'd like to hear from y...
I am attempting to automate the sitemap.xml file on my site since the content is constantly changing. I currently open the file for appending: fopen($file_name, 'a'); so that I can add the new set of tags. However, I just noticed that the entire sitemap file has to be ended with a tag which means that every time I open the file, I ne...
Guys, am not having much luck...and I've tried and tried. Have included the code below. Am doing this in Dreamweaver hence the funny code. This is the edit page. I successfully parsed 'bet_id' value from Page 1 to this page. It populates the form fields with the correct 'bet_id' and 'category_id' values based on the value parsed from pag...
Hi, I have a ENUM column in db like so, ENUM('us','uk','fr','intl')
I'm using checkboxes to confirm the country in HTML and the PHP is
SET country ='".$country_us." ".$country_uk." ".$country_fr." ".$country_intl."'
The query passes but it does not add to the column.
If I do just
country ='$country_us'
-- it works fine.
Here's...
Situation:
Have a SET field called country with values
('us','uk','fr','intl')
When I go to pull the content from the db:
$sql = "SELECT id, title, content ";
$sql .= "FROM table_name ";
$sql .= "WHERE country='us'";
Works fine with entries labeled only 'us' but if the entry is 'us,uk' or 'us,fr,intl' and so forth. It does not ...
for example when i retrieve from database the word program's instead of program's what would be shown is program�s. ' and - changes to �. how can i fix this?
...
Hello, i have this:
parent.php:
require_once 'child.php';
child.php:
echo __FILE__;
It will show '.../child.php'
How can i get '.../parent.php'
...
I do a bit of HTML/CSS for fun but I am looking at picking up some programming skills.
I have been reading up on PHP and MySQL. So far I have not found it too hard understanding the concepts such as loops, condition statements etc but I want to get stuck in and start developing an app before I get too bored reading and giving up comple...
Greetings,
I am setting up a pretty standard registration form with password field.
The problem is, after a failed submission (due to empty field, incorrect format etc), the controller reloads the registration page, but with the password field containing the hashed value of the previously entered password. How do I make it empty after ...
I heard a rumor, that Java consumes less energy than PHP and was wondering if and how this would be true. I'm currently working in a company where we base most of our apps on PHP. Power consumption has never been the problem for us, but we are working on bigger projects where it might matter. We love PHP for web developing and are wonder...
Hi there,
I'm trying to send out a Plain/HTML multipart email out and I'm currently using PHP's mail() function. Many people have recommended PHPMailer so I thought I'd give it a go.
However, as everything seems to be nowadays, it appears very complicated. I downloaded it and it talks about installing it and configuring MySQL connectio...