Search the Community
Showing results for tags 'txt'.
-
Hi, I've got a "data.txt" file with the following content: One1:One2:One3:One4:One5:One6 Two1:Two2:Two3:Two4:Two5:Two6 Three1:Three2:Three3:Three4:Three5:Three6 Now I want to be able to take each data and put on a specific location of a htlm code. Each line for its own. So for the first line, it should look something like this: <html> <head> <title></title> <head> <body> <h1>One2</h1> <h2>One4 some other Text One5</h2> <img src="One6.jpg"> </body> </html> Unforturtunately I don't have a clue how to do that. Can anybody help me out or does someone know a good and easy tutorial? Thanks a lot
-
I would like to send an email when % is >than 50%, if so get fields from Txt fiel and fields from DB and send an email to the address in the txt file. <html> <head><title>Email Alert</title></head> <body> <?php require 'PHPMailerAutoload.php'; $mail = new PHPMailer; //$mail->SMTPDebug = 3; // Enable verbose debug output mysql_connect("ip","user","pass") or die(mysql_error()); //mysql_select_db("DB") or die(mysql_error()); //$sql = "SELECT * from pool"; $sql = mysql_db_query ("demo", "select * from pool "); while ($row = mysql_fetch_assoc($sql)) { $sql = "SELECT '%' FROM pool Where >= 50 "; { //echo $row->number; $percent = $row['%'] ; $pool2 = $row['pool']; $balance = $row['balance']; /////////////////////////// //data from file ////////// ////////////////////////// $file = fopen('EmailAndPool2.csv', 'r'); $fields = array(); if ($file) { while (($data = fgetcsv($file)) !== false) { if(empty($fields)) { $fields = $data; continue; } $row = array_combine($fields, $data); // Format output conveniently with sprintf $output = sprintf("%s Pool %s email.\n", $row['pool'], $row['email']); echo $output; } fclose($file); $pool1 = $row['pool']; //while ($pool2 == $pool1 and $percent > "50") $pool2 =$row['pool2']; $mail = new PHPMailer; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'xxxxxxxxx; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'xxxxxxxxxxxxxxxxx'; // SMTP username $mail->Password = 'xxxxxxxxxxxxxxxx; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->FromName = 'Support'; $mail->addAddress ($row['email']); //$mail->addAddress = $members; //$mail->addCC('xxxxxxxxxxx'); //$mail->addCC('xxxxxxxxxxxxxxxx'); $mail->WordWrap = 50; // Set word wrap to 50 characters $mail->isHTML(true); $mail->Subject = 'test'; $mail->Body = 'test '; $email_from = 'xxxxxxxxxxxx'; } if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } } } ?> </body> </html> Thank you
-
Hello, I am trying to load a txt file into mysql -uroot to create a database with all the tables and everything is prewritten. Here is what I thought I was supposed to write (but it's not working): mysql -uroot < skel_mysql.txt the skel_mysql.txt file is located in xampp/mysql/bin and this is a copy of the text in the file. CREATE DATABASE skel; USE skel; CREATE TABLE customers ( ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, LAST CHAR(20) NOT NULL, FIRST CHAR(20) NOT NULL, PHONE CHAR(20) NOT NULL, SESSID CHAR(32) NOT NULL ); CREATE TABLE products ( SKU INT NOT NULL PRIMARY KEY, NAME CHAR(20) NOT NULL, DESCR VARCHAR(40) NOT NULL, PRICE DECIMAL(9,2) NOT NULL, IMAGE VARCHAR(20) NOT NULL ); INSERT INTO products VALUES(1121,'Small Lab Coat','White Lab Coat Adult Small',15.75,'labcoat.png'), (1122,'Medium Lab Coat','White Lab Coat Adult Medium',15.75,'labcoat.png'), (1123,'Large Lab Coat','White Lab Coat Adult Large',16.75,'labcoat.png'), (1124,'Beaker Kit','Set of 5 different beakers',22.05,'beakers.png'), (1125,'Petri Dishes','Set of three',9.99,'petri.png'), (1126,'Safety Glasses','Women's Safety Glasses',15.75,'wmglass.png'), (1127,'Mens Safety Glasses','Men's Safety Glasses',15.75,'mglass.png'), (1128,'Kids Safety Glasses','Kid's Safety Glasses',15.75, 'kglass.png'), ; CREATE TABLE cart ( ID CHAR(32) NOT NULL, DATE DATETIME NOT NULL, QTY INT NOT NULL, SKU INT NOT NULL ); Side note: I thought there was an error in my database so I dropped it and rewrote the code in a txt file and now I dont want to rewrite everything in the cmd prompt. This is for a simple shopping cart assignment Im doing for a PHP class.
-
I'm just trying to load some of the echoed results in to a txt file that I can use myself. I assumed that there should be a txt file in my server directory but no file has been created. What am I doing wrong? while ($blekr<=$blekko_count) { echo '<a href='.$Blekko[$blekr]['url'].'><h4>'.$Blekko[$blekr]['url_title'].'</h4></a>'; echo '<p>'.$Blekko[$blekr]['snippet'].'<p>'; echo '<b>'.$Blekko[$blekr]['engine'].'</b>'; $file = 'Blekko.txt'; file_put_contents($file, $Blekko[$blekr]['url'], FILE_APPEND); echo '<hr>'; $blekr++; } The echo statements run fine but no file anywhere to be found. There isn't anything said in the manual either ...
- 3 replies
-
- file_put_contents
- txt
-
(and 1 more)
Tagged with:
-
Hi All, Having a dilema here... I run a games server, its a crap web based game - ill not go into detail. Anyhow, the server URL changes when the server is restarted, this is automatically saved into a text file. I then have a batch file which automatically copies this file onto my web server every 10 minutes. I then have a php page which reads this text file and a couple others. The webpage looks a little like; Server Status online Server Address www.webgame.com etc.etc.... The problem is, the link doesnt display as a clickable link, this is what I am wanting. Its just displayed as plain text, you have to then copy and paste this link into your browser, I would really like the link to just be clickabe. The code I am currently using is; <p align="center" class="style1">Server Location:</p> <p align="center" class="style3"> <?php $filename = "externalurl.txt"; $filehandle = fopen($filename, "r"); $contents = fread($filehandle, filesize($filename)); fclose($filehandle); echo $contents; ?> </p> <br> I basically want the link to display as is, I did try putting the whole thing inside <a href"<CODE>"> this unsurprisingly didnt work. I have seen loads of other help websites etc, these all only show methods of displaying links that have the actual code in the text file, my text file has no code in there, just the actual link - and this cannot be changed. Any help would be greatly apreciated.