Jump to content

Search the Community

Showing results for tags 'php5'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 17 results

  1. Hello guys. Im not familiar with PHP but I was asked to convert our Homepage which uses a Database to store tickets from 5.x to 7.3.9 . Now I get this error: I'd appreaciate any help from you guys, tia. :)
  2. Hi All, I've been interested in writing a PHP pdo configuration file so that I can include connections in various files on my site. While I was looking up some possible solutions I stumbled across an interesting post on stack overflow http://stackoverflow.com/questions/11369360/how-to-properly-set-up-a-pdo-connection The first responder suggested the code below. However, I don't understand how to access the connection and make query calls. I'm confused by how it's possible to return a variable name as an object { return new $name( $this->connection ) }. Also, If someone could explain what the author means by { $something = $factory->create('Something');}. Wouldn't the "Something" need to be a class? And how would that class get the db connection? All the best, Karma $provider = function() { $instance = new PDO('mysql:......;charset=utf8', 'username', 'password'); $instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $instance->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); return $instance; }; class StructureFactory { protected $provider = null; protected $connection = null; public function __construct( callable $provider ) { $this->provider = $provider; } public function create( $name) { if ( $this->connection === null ) { $this->connection = call_user_func( $this->provider ); } return new $name( $this->connection ); } } $factory = new StructureFactory( $provider ); $something = $factory->create('Something'); $foobar = $factory->create('Foobar');
  3. Hello to everyone! I've got a script written in php4 and would like to convert it to php5, I can't find either a paid or open source version of any script similar. I don't know enough to do this myself, but can work it all out if someone could give me a hand with this first part, how would this be written in php5? <?php session_start(); // Require standard files include("./require/config.php"); require("./require/authmember.php"); require("./require/functions.php"); include("./include/get_config.inc.php"); $content="./include/index.inc.php"; if(session_is_registered("valid_user")) { $menu="./include/menu_v.inc.php"; } else { $menu="./include/menu_u.inc.php"; } //Page Description $page_title="Welcome to $site_name"; //Meta description tag $description=""; //Meta keywords tag $keywords=""; include("./include/header.inc.php"); include("./include/body.inc.php"); include("./include/footer.inc.php"); ?> Your help would be most appreciated, thanks in advance.
  4. Can anyone suggest how to build web app like http://www1.lost-in-val-sinestra.com/ without flash. We want to pull the data from facebook and using pulled data edit the sample video and play in the browser. I was thinking to use image magick with ffmpeg to edit the video but unable to do it successfully. I tried to edit video using below steps 1. Extract all frames from the video using ffmpeg. 2. Identify the frames need to be customized. 3. Identify the coordinates of placeholders where we need to place the facebook data. 4. Using image magick customized frames with facebook image (facing difficulty here as the video moves continously taking coordinate of each frames is tedious) 5. Create final video with edited frames using ffmpeg.
  5. mysql.php <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("ckeditor",$con); ?> --------------------------------------------------------- add.php <?php include("mysql.php"); if(isset($_POST["button2"])) { $sql="INSERT INTO cktext (section) VALUES ('$_POST[select2]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } ?> ----------------------------------------------------------------- home.php <form id="form1" name="form1" method="post" action="add.php"> <tr> <td>Section:</td> <td><select name="select2" id="select2"> <option selected="selected" value="MALE">Male</option> <option selected="" value="FEMAIL">FEMAIL</option> </select></td> </tr> <input type="submit" name="button2" id="button2" value="Upload" /> </form> In DATABASE :- cktext table attribute "section" is varchar type. BUT IT RETURN ME BLANK OUTPUT.
  6. Hi all, I was wondering, if 1. I activate all errors except notices: error_reporting(E_ALL & ~E_NOTICE); ini_set('display_errors', 1); 2. my environment is php5.5 3. I get no errors Is my code then php5? I do not use any OOP, do I have to, to use php5? regards, Milou.
  7. I'm not new to Linux, but I am new to php. I'm trying to set up a lamp server. Using Debian 7.2, Apache2, Mysql, and PHP. I want to install wordpress eventually. Doing all this in a VM using virtualbox (4.2.10). Now, have installed the OS. Using apt-get installed apache, mysql, and php. Apache is installed. the test page displays. Mysql I can log into the mysql cli. The php test page does not display. The browser (firefox) says it can't find the file. This test uses the code as follows: <?php phpinfo(); ?>php it was placed in /var/www (the same place the test index.html file is). Further, when I type php -a to invoke the interactive php shell, it seems to halfway work. It acts as if I was in a cli shell, except it doesn't display any kind of a prompt. Further, I can type stuff into this, but it does nothing except move to the next line (after pressing the enter key, as if it was text editor) or nothing. For example, type "echo 5+8;" produces nothing. Looking up documentation on installing these components in debian, the docs say I should have a file libphp5.so in a modules diirectory somewhere. Using find I cannot fine a file libphp5.so nor a directory module or modules. So, a little help here. Anyone have a clue why this is not happening? Thanks, Mark
  8. My error codes are not working , i declared them as follow if(isset($_POST['login_submit'])){ $query = mysql_query("SELECT id FROM users WHERE login_email = '". $_POST['login_email'] ."'") or die(mysql_error()); $email_check = mysql_num_rows($query); $email_check_data = mysql_fetch_array($query); if(empty($_POST['login_email']) || empty($_POST['login_password'])){ echo "<div class=\"notification warning\"> Please fill in all the fields below </div>"; } elseif($email_check == 0) { echo "<div class=\"notification error\"> Email address or password . Please check your email! </div>"; is there anything wrong ? If the fields are empty or i input no email or password no erros displayed
  9. Hi this is my first post after registering here. Please help me. I have a string of user data comma separated as below and pipe separated.I have been trying to remove duplicates by converting it to array. And even with php But it all does not works. My data looks like below: Marja_Roxburgh|abc@abc.com|123-456-7890|N/A|2011-11-17|N/A|N/A|N/A|N/A|N/A|120, Santa_Roxburgh|bmw@abc.com|123-456-7890|N/A|2013-11-17|N/A|N/A|N/A|N/A|N/A|10, Marja_Roxburgh|abc@abc.com|123-456-7890|N/A|201-11-17|N/A|N/A|N/A|N/A|N/A|300, Saga_Shera|xyz@abc.com|123-456-7890|N/A|2013-11-17|N/A|N/A|N/A|N/A|N/A|0, Marja_Roxburgh|abc@abc.com|123-456-7890|N/A|2013-11-17|N/A|N/A|N/A|N/A|N/A|120 I have tried What's the best way to remove duplicates from a string in PHP (or any language)?, detecting duplicate string in a explode function php and like this How to detect duplicate values in PHP array? one too. But none of these works in my case. Coz my data is not unique for same User say Marja_Roxburgh. I wants to remove all entries of Marja_Roxburgh based on its email but also wants to keep the first one only and sum all amounts from its transactions. I've been googling for any logic Im not able to understand what to do this it. How Do I keep only first Record of Marja_Roxburgh and remove all other of her. And also sum all her Amounts before removing her data? I'm missing the logic to understand and solve this problem. Can somebody help me understand this logic? any Ideas? Thanks
  10. I have a problem that when I submit the page goes blank or goes to the location specified in header but it does not update the sql record. This used to work but I made some changes and now I cannot get it back. Any assistance would be appreciate. <?php require('edb.php'); $id=$_REQUEST['id']; $ActivateCode=$_REQUEST['ActivateCode']; $result=mysql_query("SELECT * FROM `eusers` WHERE id = '$id' && ActivateCode = '$ActivateCode'"); $test=mysql_fetch_array($result); if (!$result) { die("Error: Data not found.."); } $id=$test['id']; $FirstName=$test['FirstName']; $LastName=$test['LastName']; $State=$test['State']; $Username=$test['Username']; $Password=$test['Password']; $Email=$test['Email']; $Active=$test['Active']; $SecurityCode=$test['SecurityCode']; $AdviserCode=$test['AdviserCode']; $UserType=$test['UserType']; $ActivateCode=$test['ActivateCode']; if(isset($_POST['Submit'])) { $Password_save =sha1($_POST['Password']); $Email_save =$_POST['Email']; $Active_save =$_POST['Active']; $SecurityCode_save =$_POST['SecurityCode']; $ActivateCode_save =$_POST['ActivateCode']; mysql_query("UPDATE `eusers` SET Password ='$Password_save', Email ='$Email_save', Active ='$Active_save', SecurityCode ='$SecurityCode_save', ActivateCode ='$ActivateCode_save' WHERE id ='$id'") or die(mysql_error("Did not Save")); echo "Saved!"; header("Location: index.php"); } ?>
  11. Ok , there is an issue with the rotten tomatoes API , It gives developers the ability to set a limit of movies to return from the API from a specific category , like the movies in the box office are pulled dynamically, but when I set the limit to 50 , or even 10 movies , it only returns an array containing 3 movies instead of 10 or 50 or whatever the limit of movies is in the API call ... What could be causing that ? is there maybe something wrong with the way I am using the file_get_contents function $box_office_movies = file_get_contents('http://api.rottentomatoes.com/api/public/v1.0/lists/movies/box_office.json?limit=50&country=us&apikey=[key]',FILE_USE_INCLUDE_PATH); $box_office_movies = json_decode($box_office_movies, true); var_dump($box_office_movies); // returns only 3 movies ..
  12. I've been trying to solve this for the past 2 days! Please help. I get this message while trying to validate the code in W3c valifation service. bad value %20images/image_name%20 for attribute src on element img: Whitespace in path component. Use %20 in place of spaces. There is no white space in the lines below. OR is there? I have put %20 in all white spaces that I could find with no effect. if (is_file(MM_UPLOADPATH . $row['picture']) . filesize(MM_UPLOADPATH . $row['picture']) > 0){echo'%20<a href="pictures.php">%20<img src="%20' . MM_UPLOADPATH . $row['picture'] . '%20" alt="sevenoaks latest pic" style="width:75px; maxheight:110px; margin:5px; padding:5px;"></a>'; if (is_file(MM_UPLOADPATH . $row['picture']) . filesize(MM_UPLOADPATH . $row['picture']) > 0){echo'%20<a href="pictures.php">%20<img src="%20' . MM_UPLOADPATH . $row['picture'] . '%20" alt="sevenoaks latest pic" style="width:75px; maxheight:110px; margin:5px; padding:5px;"></a>';
  13. So I have this PHP script below that requests data from the Twitter API and then displays it on the page according to the information that I have in my local database because I stored twitter usernames of some twitter users so I can pass them to the API and display the profile images of those twitter users. The script works fine to display my request from the API but it is AWFULLY slow , so I was wondering what could cause the script to be so slow ... Below is my script .. the first part seems to execute fine... /* Create a TwitterOauth object with consumer/user tokens. */ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); $url = $connection->get('statuses/user_timeline', array('screen_name' => $row['Twitter'],count=>'1')); $results = json_encode($url); $data = json_decode($results, true); $image = ''; if(is_array($data)){ $image = $data[0]['user']['profile_image_url']; $image_bigger = str_replace('_normal', '_bigger',$image); } echo "<h1 align='middle' id = $id> $name Vs Opposition </h1>"; echo "<img src='".$image_bigger."' width= '100' height ='100' class= 'image' align='middle' />"; ?> //This part of the script below seems to be the culprit of the page taking so long to display info because it loops through all the twitter IDs returned by the query in order to display the images of the authors that I request through the API inside the loop . $data2 variable is very long array of info regarding the twitter user and from that array , I pick the key of the array containing the value that stores the picture of every twitter user inside a loop .. How could I dynamically optimize this so I can get all those images ? <?php $select2 = "SELECT * FROM AUTHORS WHERE ID <> $id"; $result2 = mysql_query($select2); $result_count = mysql_num_rows($result2); $image_array = array(); $unique_id = array(); $counter = 0; if($result_count > 0) { while ($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { array_push($unique_id, $row2['ID']); $url2 = $connection->get('statuses/user_timeline', array('screen_name' => $row2['Twitter'],count=>'1')); $results2 = json_encode($url2); $data2 = json_decode($results2, true); // data through is a very long array $image2 = $data2[$counter]['user']['profile_image_url']; $image3 = str_replace('_normal', '_bigger',$image2); array_push($image_array,$image3); } } var_dump($data2); exit; ?> <div id="test"> <iframe id="frame" src="" width="100%" height="100% frameBorder="0" "> </iframe> </div> <div id ="opposition"> <?php $unique_image = array_unique($image_array); $id_array = array_unique($unique_id); $i = 0; foreach($unique_image as $content) { echo "<a id ='".$id_array[$i]."' href ='#'><img src='".$content."' width= '100' height ='100' class='image' /></a>"; $i++; } ?> </div>
  14. Alright Im trying to grab product information from google play to display apps such as price, name, author, and app icon. The issue Im having is on my local server everything shows up fine but when uploaded to the server the price is in a different currency(Yen I think) and I want to display only in USD. Im using curl_init at the moment(it a part of a function) I visit the page and it is in the correct currency, but display Yen with the script) $ch = curl_init(); $timeout = 0; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE); $file_contents = curl_exec($ch); if (!$file_contents) { print_r(curl_getinfo($ch)); die; } curl_close($ch); } else { $file_contents = file_get_contents($url); } return $file_contents; } Is there anything I can, or is there another way I could handle getting this information?
  15. Hi all, I am new here and was looking for some help.I am new to programming java and php using app inventor and have no experience with MYSQL although i have been educated on theory and concepts. Problem: User fills out for on appinventor app form and clicks submit button. This app talks with my php script below (Dont know how i did it but coudnt get anyones elses to work so i wrote my own from PHP scratch) and input the userdata one PHPscript or "form field" at a time causing the database to look like this. Firstname Lastname ___________________RID___ John NULL 1 NULL Smith 2 What i need it to do is dump all the form data at once or keep the session with the same unique ID or RID?(Not sure if i know what im talking about here). This is the script that takes the info from my appinventor userinput and plants it in mySQL data base under the appropriate field. problem is when second script is ran(idont know php very well) it puts the lastname in the database but it doesnt put it at the same key or unique id as the first name? --------------------------------------------------------------------------------------------------------------------------------------------------------- <?php $FirstName = $_GET['FirstName']; $con=mysqli_connect("XXXXXXXXXX","XXXXXXXX","XXXXXXXX","XXXXXXX"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysqli_query($con,"INSERT INTO SmallBook (FirstName) VALUES ('$FirstName')"); mysqli_close($con); ?> ___________________________________________________________ second script ----------------------------------------------------------------------------------------------- <?php $LastName = $_GET['LastName']; $con=mysqli_connect("XXXXXXXXXX","XXXXXXXX","XXXXXXXX","XXXXXXX"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysqli_query($con,"INSERT INTO SmallBook (LastName) VALUES ('$LastName')"); mysqli_close($con); ?> Thanks in advance, ~James PS: not sure if it helps but my scripts are save as .php5
  16. Hey Guys, I need a little help. I have a registration form that when submitted places all information into a DB and then takes the submitter to a payment pageto pay a registration fee This works great. I also have paypal ipn setup to recieve the details of the payments and this also works great. And finally i have a page that outputs the information of the registration table with a field "Paid" that is either going to be Yes or No and this is where i am having issues. What i am trying to accomplish is have a script that will check both tables (reg/pament) and combine the information into variables so that i can build if statements to display weather or not the user has paid the reg fee. an example is below as well as the current code that i have inplace and working. I was thinking of using a rand() to generate a random string of about 5 digits and during the registration process emailing it to the user and when they make thier payment require the random string so that there is a linking item that will always be there. Mainly to avoid the issue of someon not having the same email address for emailing and a different one for paypal. other than email there isn't much to link with. What do you think? Reg Table CREATE TABLE `XXX` ( `id` int(3) NOT NULL auto_increment, `name` varchar(50) NOT NULL, `department` varchar(100) NOT NULL, `email` varchar(75) NOT NULL, `member` varchar( NOT NULL, `member_id` varchar(30) NOT NULL, `chapter` varchar(255) NOT NULL, `shirt` varchar(18) NOT NULL, `class_1` varchar(10) NOT NULL, `class_2` varchar(10) NOT NULL, `attending` varchar(255) NOT NULL, `paid` varchar(4) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ; Payment Table CREATE TABLE `ZZZZ` ( `id` int(10) unsigned NOT NULL auto_increment, `raw_log_id` int(10) default NULL, `receiver_email` varchar(127) collate utf8_bin default NULL, `payment_status` varchar(25) collate utf8_bin default NULL, `pending_reason` varchar(25) collate utf8_bin default NULL, `payment_date` varchar(100) collate utf8_bin default NULL, `option_name1` varchar(64) collate utf8_bin default NULL, `option_selection1` varchar(200) collate utf8_bin default NULL, `option_name2` varchar(64) collate utf8_bin default NULL, `option_selection2` varchar(200) collate utf8_bin default NULL, `option_name3` varchar(64) collate utf8_bin default NULL, `option_selection3` varchar(200) collate utf8_bin default NULL, `option_name4` varchar(64) collate utf8_bin default NULL, `option_selection4` varchar(200) collate utf8_bin default NULL, `option_name5` varchar(64) collate utf8_bin default NULL, `option_selection5` varchar(200) collate utf8_bin default NULL, `option_name6` varchar(64) collate utf8_bin default NULL, `option_selection6` varchar(200) collate utf8_bin default NULL, `option_name7` varchar(64) collate utf8_bin default NULL, `option_selection7` varchar(200) collate utf8_bin default NULL, `option_name8` varchar(64) collate utf8_bin default NULL, `option_selection8` varchar(200) collate utf8_bin default NULL, `option_name9` varchar(64) collate utf8_bin default NULL, `option_selection9` varchar(200) collate utf8_bin default NULL, `memo` varchar(255) collate utf8_bin default NULL, `shipping_method` varchar(100) collate utf8_bin default NULL, `btn_id` varchar(50) collate utf8_bin default NULL, `mc_gross` double default NULL, `mc_fee` double default NULL, `mc_shipping` double default NULL, `mc_handling` double default NULL, `shipping_discount` double default NULL, `insurance_amount` double default NULL, `handling_amount` double default NULL, `shipping` double default NULL, `tax` double default NULL, `mc_currency` varchar(10) collate utf8_bin default NULL, `txn_id` varchar(25) collate utf8_bin default NULL, `txn_type` varchar(25) collate utf8_bin default NULL, `first_name` varchar(75) collate utf8_bin default NULL, `last_name` varchar(75) collate utf8_bin default NULL, `address_street` varchar(200) collate utf8_bin default NULL, `address_city` varchar(50) collate utf8_bin default NULL, `address_state` varchar(40) collate utf8_bin default NULL, `address_zip` varchar(20) collate utf8_bin default NULL, `address_country` varchar(64) collate utf8_bin default NULL, `address_status` varchar(25) collate utf8_bin default NULL, `payer_email` varchar(127) collate utf8_bin default NULL, `payer_status` varchar(25) collate utf8_bin default NULL, `payment_type` varchar(25) collate utf8_bin default NULL, `notify_version` varchar(50) collate utf8_bin default NULL, `verify_sign` varchar(255) collate utf8_bin default NULL, `address_name` varchar(130) collate utf8_bin default NULL, `transaction_subject` varchar(150) collate utf8_bin default NULL, `protection_eligibility` varchar(50) collate utf8_bin default NULL, `ipn_status` varchar(25) collate utf8_bin default NULL, `subscr_id` varchar(25) collate utf8_bin default NULL, `custom` varchar(255) collate utf8_bin default NULL, `reason_code` varchar(25) collate utf8_bin default NULL, `contact_phone` varchar(25) collate utf8_bin default NULL, `item_name` varchar(127) collate utf8_bin default NULL, `item_number` varchar(127) collate utf8_bin default NULL, `invoice` varchar(127) collate utf8_bin default NULL, `for_auction` tinyint(10) default NULL, `auction_buyer_id` varchar(75) collate utf8_bin default NULL, `auction_closing_date` varchar(100) collate utf8_bin default NULL, `auction_multi_item` double default NULL, `creation_timestamp` timestamp NULL default CURRENT_TIMESTAMP, `address_country_code` varchar(2) collate utf8_bin default NULL, `payer_business_name` varchar(150) collate utf8_bin default NULL, `receiver_id` varchar(15) collate utf8_bin default NULL, `test_ipn` tinyint(1) default '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=4 ; Current SQL Code: Displays the information from Reg table I need to show if the user has paid by also looking up the payment table. <table width="100%" border="0" cellspacing="2" cellpadding="2"> <tr> <td align="center"><img src="../images/image.png" width="750" height="90" /></td> </tr> <tr> <td align="center"><h1>Title</h1></td> </tr> <tr> <td align="center"><h2>Sub Title</h2></td> </tr> <tr> <td align="center"></td> </tr> <tr> <td align="center"></td> </tr> </table> <?php include("../includes/sql-conn.php"); $db = mysql_connect ($hostname, $username, $password) or die ('Failed to connect to database: ' . mysql_error()); mysql_select_db($database); $query = 'SELECT * FROM XXX WHERE class_1 = "Option A" ORDER BY Name ASC'; $result = mysql_query($query) or die ('Failed to query ' . mysql_error()); ?> <table width="100%"> <tr> <th scope="col">Option A</th> <th scope="col">Name</th> <th scope="col">Department</th> <th scope="col">Email</th> <th scope="col">Member ID</th> <th scope="col">Chapter</th> <th scope="col">Shirt Size</th> <th scope="col">Second Choice</th> <th scope="col">Attending</th> <th scope="col">Paid</th> </tr> <?php while ($row = mysql_fetch_assoc($result)) { $name = $row['name']; $department = $row['department']; $email = $row['email']; $member = $row['member']; $memberid = $row['member_id']; $chapter = $row['chapter']; $shirt = $row['shirt']; $class_1 = $row['class_1']; $class_2 = $row['class_2']; $attending = $row['attending']; $paid = $row['paid']; if ($member == "Yes"){ $amount = "$30.00"; }else{ $amount = "$50.00"; } ?> <tr> <td> </td> <td><div align="center"><?php echo "$name";?></div></td> <td><div align="center"><?php echo "$department";?></div></td> <td><div align="center"><?php echo "$email";?></div></td> <td><div align="center"> <?php if (!$memberid){echo "N/A";}else{ echo "$memberid";}?> </div></td> <td><div align="center"><?php if (!$chapter){ echo "N/A"; }else{ echo "$chapter";} ?></div></td> <td><div align="center"><?php echo "$shirt";?></div></td> <td><div align="center"><?php echo "$class_2";?></div></td> <td><div align="center"><?php echo "$attending";?></div></td> <td><div align="center"><?php if ($paid == ""){ echo ("No Info"); }else{echo "$paid"; echo (" ( $amount)");}?></div></td> </tr> <?php } ?> </table> <?php mysql_free_result($result); mysql_close($db); ?> <hr /> <?php $db2 = mysql_connect ($hostname, $username, $password) or die ('Failed to connect to database: ' . mysql_error()); mysql_select_db($database); $query2 = 'SELECT * FROM XXX WHERE class_1 = "Option B" ORDER BY Name ASC'; $result2 = mysql_query($query2) or die ('Failed to query ' . mysql_error()); ?> <table width="100%"> <tr> <th scope="col">Option B</th> <th scope="col">Name</th> <th scope="col">Department</th> <th scope="col">Email</th> <th scope="col">Member ID</th> <th scope="col">Chapter</th> <th scope="col">Shirt Size</th> <th scope="col">Second Choice</th> <th scope="col">Attending</th> <th scope="col">Paid</th> </tr> <?php while ($row = mysql_fetch_assoc($result2)) { $name = $row['name']; $department = $row['department']; $email = $row['email']; $member = $row['member']; $memberid = $row['member_id']; $chapter = $row['chapter']; $shirt = $row['shirt']; $class_1 = $row['class_1']; $class_2 = $row['class_2']; $attending = $row['attending']; $paid = $row['paid']; if ($member == "Yes"){ $amount = "$30.00"; }else{ $amount = "$50.00"; } ?> <tr> <td> </td> <td><div align="center"><?php echo "$name";?></div></td> <td><div align="center"><?php echo "$department";?></div></td> <td><div align="center"><?php echo "$email";?></div></td> <td><div align="center"> <?php if (!$memberid){echo "N/A";}else{ echo "$memberid";}?> </div></td> <td><div align="center"><?php if (!$chapter){ echo "N/A"; }else{ echo "$chapter";} ?></div></td> <td><div align="center"><?php echo "$shirt";?></div></td> <td><div align="center"><?php echo "$class_2";?></div></td> <td><div align="center"><?php echo "$attending";?></div></td> <td><div align="center"><?php if ($paid == ""){ echo ("No Info"); }else{echo "$paid"; echo (" ( $amount)");}?></div></td> </tr> <?php } ?> </table> <?php mysql_free_result($result2); mysql_close($db2); ?> <hr /> <?php $db3 = mysql_connect ($hostname, $username, $password) or die ('Failed to connect to database: ' . mysql_error()); mysql_select_db($database); $query3 = 'SELECT * FROM XXX WHERE class_1 = "Option C" ORDER BY Name ASC'; $result3 = mysql_query($query3) or die ('Failed to query ' . mysql_error()); ?> <table width="100%"> <tr> <th scope="col">Option C</th> <th scope="col">Name</th> <th scope="col">Department</th> <th scope="col">Email</th> <th scope="col">Member ID</th> <th scope="col">Chapter</th> <th scope="col">Shirt Size</th> <th scope="col">Second Choice</th> <th scope="col">Attending</th> <th scope="col">Paid</th> </tr> <?php while ($row = mysql_fetch_assoc($result3)) { $name = $row['name']; $department = $row['department']; $email = $row['email']; $member = $row['member']; $memberid = $row['member_id']; $chapter = $row['chapter']; $shirt = $row['shirt']; $class_1 = $row['class_1']; $class_2 = $row['class_2']; $attending = $row['attending']; $paid = $row['paid']; if ($member == "Yes"){ $amount = "$30.00"; }else{ $amount = "$50.00"; } ?> <tr> <td> </td> <td><div align="center"><?php echo "$name";?></div></td> <td><div align="center"><?php echo "$department";?></div></td> <td><div align="center"><?php echo "$email";?></div></td> <td><div align="center"> <?php if (!$memberid){echo "N/A";}else{ echo "$memberid";}?> </div></td> <td><div align="center"><?php if (!$chapter){ echo "N/A"; }else{ echo "$chapter";} ?></div></td> <td><div align="center"><?php echo "$shirt";?></div></td> <td><div align="center"><?php echo "$class_2";?></div></td> <td><div align="center"><?php echo "$attending";?></div></td> <td><div align="center"><?php if ($paid == ""){ echo ("No Info"); }else{echo "$paid"; echo (" ( $amount)");}?></div></td> </tr> <?php } ?> </table> <?php mysql_free_result($result3); mysql_close($db3); ?>
  17. Hello, I wrote an emailer script to add to my web site. The code seems to be fine and the variables seem to parse, but still I can not send an e-mail. Could you please tell me what am I doing wrong? I think the error is somewhere in the sendEmail function, but a second opinion is always better to have. The code is: <?php class emailer { private $sender; private $subject; private $body; function __construct($sender) { $this->sender = $sender; //$this->recipient = $recipient; } function addSender($sender){ $this->sender = $sender; } function addSubject($subject){ $this->subject = $subject; } function addBody($body){ $this->body = $body; } function sendEmail(){ $this->recipient = 'test@mail.com'; $this->result = mail($this->recipient, $this->subject, $this->body, "From: {$this->sender} \r\n"); if (!$this->result){ echo $this->result; echo $this->recipient; echo $this->sender; echo $this->subject; echo $this->body; echo "Error"; } else{ echo "e-mail was sent."; } } } ?> Thank you in advance. PS. when I execute the script, I get as output "Error", and I also get the data stored in the variables (recipient,sender,subject, and body).
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.