PHP - Php Code Needed In Displaying The Datas Frm Db In A New Line
I hav a php page which takes data from the db.But the problem i am facing is for a particular fild in database ,i have long data,which i need to b displayed in a wordwrap way
eg my data is " Description need a site for school gave order on 12-10-2010 work started on 12-10-2010 " this shuld be displayed as "Description need a site for school gave order on 12-10-2010 work started on 12-10-2010" Description is the field in the database and rest of them are the datas in it Similar TutorialsI want my application will send a email after 10 minutes of sending another email. In my application A user completes registration with payment Application sends the user a payment confirmation emailNow I want to send another email 10 minutes After payment confirmation email with welcome tipsBelow is the function where for user setup .
public function finishUserSetup($Sub){ if($Sub == 0){ $subscription = SubscriptionPlans::where('identifier', '=', "Monthly")->first(); $expiry = date('Y-m-d', strtotime('+' . $subscription->months . ' months')); $sub_period = "monthly"; } else{ $subscription = SubscriptionPlans::where('identifier', '=', "Annually")->first(); $expiry = date('Y-m-d', strtotime('+' . $subscription->months . ' months')); $sub_period = "annually"; } $this->expiry_date = $expiry; $this->user_type = "SUB"; $this->subscription_period = $sub_period; $this->update(); $replaceArray = array( 'fullname' => $this->forename . " " . $this->surname, 'subscriptionName' => $subscription->name, ); EmailTemplate::findAndSendTemplate("paymentconfirm", $this->email, $this->forename . " " . $this->surname, $replaceArray); } In the above function the last line of code is the one which sends a payment confirmation email to the user which is EmailTemplate::findAndSendTemplate("paymentconfirm", $this->email, $this->forename . " " . $this->surname, $replaceArray); I want to execute the following line of code 10 minutes after the above one
EmailTemplate::findAndSendTemplate("WelcomeTips", $this->email, $this->forename . " " . $this->surname, $replaceArray);
How to do that. that is running the last line of code 10 minutes after Hi, I am pretty much a new newbie when it comes to PHP, and have a problem that I need to solve, for a website that has to go live tomorrow. Basically I have been using a javascript upload script called 'uploadify' which had an option for the upload folder which was added to the script in the form: Code: [Select] 'folder' : '/songs/<?php echo $_SESSION["name"];?>', I added the php echo to return the username from a PHP login, so it gets added to the path to the upload folder (each user has their own subfolder for uploading to). With the new version of the uploadify script, the folder option has been moved to a separate PHP file where it is now in the form: Code: [Select] $targetFolder = '/songs/'; I need to find a way of adding the username variable to this line. I have tried using echo in various ways, and googled about, but it has stumped me, simple as it may be. If anyone could let me know how I construct this line I'd be very grateful. Time is of the essence, as they say... Thanks, Nick i am a newbie.. From my tables, what code should i put to put into my site? in text.. guys please help, i have an array(52,51,52) here i want to insert first & last elements into DB, not second one does not follows the series another array (52,52,53) in this case insert first 2 elements into DB since last element does not follow the series. how is this possible? Dear All, I have login script already. i have two database one is users and another one is reference in both user_name is common. In this if a user login and search the refid means that user datas onle possible to retrieve. for others datas they cant access. i wrote the below code but it display all user datas. kindly help me <?php session_start(); if (!$_SESSION["user_name"]) { // User not logged in, redirect to login page Header("Location: login.php"); / } // Member only content // ... $con = mysql_connect('localhost','root',''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("login", $con); $user_name = $_POST['user_name']; $query = "select * from reference,users where reference.user_name=users.user_name and reference.refid='$refid'"; $result = mysql_query($query) or trigger_error('MySQL encountered a problem<br />Error: ' . mysql_error() . '<br />Query: ' . $query); while($row = mysql_fetch_array($result)) { echo $row['refid']; echo $row['origin']; echo $row['dest']; echo $row['date']; echo $row['exdate']; echo $row['user_name']; } echo "<p><a href=\"logout.php\">Click here to logout!</a></p>"; ?> <html> <form method="post" action="final.php"> Ref Id:<input type="text" name="refid"> <input type="submit" value="submit" name="submit"> </html> Hello everybody, I have found a lot of amazing advises and codes to improve on my existing codes. It seems to be an awesome site. I actually came from a background of Application programming, however I have just recently pick up a project in php. The project is about database integration, where I have to integrate 5 supplier's existing data who have different attributes into one. (each suppliers have about 30k data) I really need help and advises on how should I do the script. Here's the details, All the suppliers uses different data file, such as CSV and .xls. I am finding a way to integrate all the 5 files into one database(mysql/phpmyadmin) so it could be listed out in a shopping cart or catalog in future. However, I am unfamiliar with php, so please advice on how can i go about fixing this problem. The first problem is that each individual suppliers uses a different attributes name, for example Supplier 1 uses : SupplierName, SupplierID, SupplierAddress, Status Inside the status, the supplier uses data such as, Good, Excellent, Great while Supplier 2 uses : SName, SID, SAddress, Status and inside this supplier, the status data that are being uses is G, Ex, Gr. How can I set a consistancy on the data and converting all the properties into one so I can import this data into a proper database such as mysql/phpmyadmin. Please help, thanks in advance I'm very beginner with arrays.... i KNOW, databases exist, it's more easy.. I can't use a database.. I have to use, this.. or similar.. that doesn't requiring a database engine... So... that array...
array ( ); I search by the element [#][0].. in the +250 some will contain the same infos and I would like to make them point to the element containing the info instead of repeating it and have to update at 3-4 places when it's time. Like what it's in "10" also good for "ten", "dix" and "diez"... anyway to make that simple? by reference or...??? I'm crying.. last time I used arrays... Turbo Pascal.. at school... or was it Turbo C++ 3.0?? Maybe it was with cobol... well it was the good ol' time of the 90s!
Thanks!
-TRP-
guys, please help i have table with datas like speed of vehicle, position e.t.c from morning 8 a.m. to 8 p.m. I need to get these details, but after every 15 minutes i.e. after selecting datas at 8 a.m. it shd select datas @ 8.15 a.m. then 8.30 a.m. hw can i write a mysql query for this ? or a PHP approach is appreciated Hello, I have successfully made a script that will upload images to the album of my facebook page easily. Following is the link to that script http://radiations3.com/facebook/facebook_upload.php Now when i used the same script to upload status directly to my wall then the script is doing nothing kindly let me know what is the problem with my code Code: [Select] //posting to the page wall $attachment = array('message' => 'this is my message', 'access_token' => $access_token, 'name' => 'This is my demo Facebook application!', 'caption' => "Caption of the Post", 'description' => 'this is a description', 'picture' => 'http://radiations3.com/images/logo.png', ); $status = $facebook->api('/194458563914948/feed', 'POST', $attachment); // my page id =123456789 var_dump($status); The following code looks at my MySQL database at the due_owner field. This is a date field & if the due_owner date is less within 6 days of the current date, it sends an email to the $email variable. This code works great! The only issue I have is, is there ANY way for me to adjust this code so it will stop sending emails after the date listed in the due_owner field? At this time, the email address listed in teh $email variable still gets an email after the date in the due_owner field. If this is not possible, is it possible to adjust the code so it will only send the email one time? I have this code as part of a script that runs each night at midnight...Thanks Code: [Select] <?php include('connection.php'); $number_of_days_before = 6; $email = "employee1@email.org"; $reminder_details = ""; $todays_date = date( "Ymd" ); echo $todays_date; $year = substr($todays_date, 0, 4); $month = substr($todays_date, 4, 2); $date = substr($todays_date, 6, 2); $trigger_date = date("Ymd", mktime(0,0,0,$month, $date-$number_of_days_before,$year)); echo $trigger_date; $result = mysql_query( "SELECT due_owner, employee, pacts, dock, name, lname FROM psrinfo WHERE employee='Jane Doe' AND due_owner <= $trigger_date" ); $nr = mysql_num_rows( $result ); while( $row = mysql_fetch_array( $result ) ) { $reminder_details .= "Name: ".$row["fname"]." ".$row["lname"]."\n"; $reminder_details .= "PACTS Number: ".$row["pacts"]."\n"; $reminder_details .= "Dock: ".$row["dock"]."\n"; $reminder_details .= "Due to Owner: ".$row["due_owner"]."\n\n\n"; } mysql_free_result( $result ); if( !empty( $nr ) ) { $mailheader = "From: The Reminder System <$email>\nX-Mailer: Reminder\nContent-Type:text/plain"; mail("$email", "Due to Within 6 Days", "$reminder_details", "$mailheader"); } ?> I have a mysql database. I have some PHP code that I can view the mysql data & add data to the mysql database. I've attached a photo to look at. You will see an "Edit" button at the end. I need to be able to click on the edit button & it will bring up another page so I can edit that particular record. I do have an ID field in the mysql database that is set to auto inrement so each record has it's own ID. I have no clue where to start as I know very little about PHP. The mysql database name is flow & the table name is info. The fields in the database that you see in the photo is due_ge, due_ny, and due_rk. The page I go to view the data in the mysql database is named view.php & the file I use to enter a new record is named add.php. If I could click the "edit" button to somehow edit these date fields that would be great!! Could someone start me in the right direction? This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=355529.0 I have 99% of the code written but I still need a line or two but can't figure it out. Due_Attny is a date field. This code looks at my MySQL database & if the due_attny field is between todays date & the trigger date it will send an email to the $email variable. There is also a field in my MySQL database named a_mail_sent that by default is set to 0 which means an email has not been sent. I need to edit this code so it will look at the a_email_sent field & if the value is 0, it sends the email & updates the a_email_sent field to 1 which means the email has been sent. If the a_mail_sent field has a value of 1, I don't need the email to be sent. Can somoeone help me out with this code? Thanks Code: [Select] <?php include('connection.php'); // DB connection // Constants $number_of_days_before = 6; $email = "emailaddress@mail.org"; $reminder_details = ""; $todays_date = date( "Ymd" ); echo $todays_date; $year = substr($todays_date, 0, 4); $month = substr($todays_date, 4, 2); $date = substr($todays_date, 6, 2); $trigger_date = date("Ymd", mktime(0,0,0,$month, $date+$number_of_days_before,$year)); $insertquery = "UPDATE psrinfo SET a_mail_sent=1 WHERE employee='Employee1'"; mysql_query($insertQuery) or die ('Error updating database'); echo $trigger_date; $result = mysql_query( "SELECT a_mail_sent, due_attny, employee, pacts, dock, fname, lname FROM psrinfo WHERE employee='Employee1' AND due_attny BETWEEN $todays_date AND $trigger_date" ); $nr = mysql_num_rows( $result ); while( $row = mysql_fetch_array( $result ) ) { $reminder_details .= "Name: ".$row["fname"]." ".$row["lname"]."\n"; $reminder_details .= "PACTS Number: ".$row["pacts"]."\n"; $reminder_details .= "Dock: ".$row["dock"]."\n"; $reminder_details .= "Due to Attny: ".$row["due_attny"]."\n\n\n"; } mysql_free_result( $result ); if( !empty( $nr ) ) { // Send reminder email $mailheader = "From: Reminder System <$email>\nX-Mailer: Reminder\nContent-Type:text/plain"; mail("$email", "PSR Due Within 6 Days", "$reminder_details", "$mailheader"); } ?> Hi, Posted here as it is in regards to PHP code making MySQL queries. Let's say i had this code below: <?php # Databse query $query = mysql_query("SELECT id, admin, username, first_name, last_name, email FROM `users` WHERE username = '$username' AND password = '$password' LIMIT 1"); # Check login query if(!$query){ echo 'Oops'; } else { echo 'Login Succesful'; } ?> Now this code with slight difference: <?php # Databse query $query = mysql_query("SELECT id, admin, username, first_name, last_name, email FROM `users` WHERE username = '$username' AND password = '$password' LIMIT 1"); # Check login query if(!$query){ echo 'Oops'; } else { if (mysql_num_rows($query) == 1) { echo 'Login Succesful'; } else { echo 'Login Details Invalid'; } } ?> Now my question is in the second lot of code; i am doing a check to ensure that the query is true in terms of username and password match database login credentials by doing mysql_num_rows as in code . Basically do i need to do that extra check in the second lot of code or is the first lot of code fine in checking username and password match database and if not return oops and return Oops if query fails for any other reason ? not sure if i am creating more code that is needed. I am slightly confused see in whether the extra check in second lot of code is needed or not. Could someone please explain in simple terms to me if it is or not and why? Thanks Hi, can any see is the are mistakes in this for me. Thanks echo'<img src="skinFiles/'.$skin['thumb_name'].'"class="skinImage" onclick="changeSkin(\'skinFiles/'.$skin["css_name"].'\')" />'; How do I remove the captcha check on this line and keep it valid? if ($author && $message && ($capatcha == 6 || controlPosts::isAdmin())) I tried if ($author && $message && (controlPosts::isAdmin())) but the script wont post like this? Can you suggest a better way to write this code (I didn't create it):
<body onload="getParameterByName('url')"> <a href="" id="urllink" >Click Here</a> </body>so, I don't have to change the <body> tag? for timthumb in my wordpress i use this code to function first_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //Defines a default image $first_img = "images/default.gif"; } return $first_img; } it works really well, then i thought why not to make it show random images if timthumb dont find any image? so the 1st googling i did came up with this function: <?php function getRandomFromArray($ar) { mt_srand( (double)microtime() * 1000000 ); $num = array_rand($ar); return $ar[$num]; } function getImagesFromDir($path) { $images = array(); if ( $img_dir = @opendir($path) ) { while ( false !== ($img_file = readdir($img_dir)) ) { // checks for gif, jpg, png if ( preg_match("/(\.gif|\.jpg|\.png)$/", $img_file) ) { $images[] = $img_file; } } closedir($img_dir); } return $images; } $root = ''; // If images not in sub directory of current directory specify root //$root = $_SERVER['DOCUMENT_ROOT']; $path = 'images/'; // Obtain list of images from directory $imgList = getImagesFromDir($root . $path); $img = getRandomFromArray($imgList); ?> and to show random image i Place the following where i wish the random image to appear: Code: [Select] <img src="<?php echo $path . $img ?>" alt="" /> my question is how to place this code in my function first_image?? i need to do something like this, but it doesnt make any sense: if(empty($first_img)){ //Defines a default image $first_img = " <img src="<?php echo $path . $img ?>" alt="" /> this was my thought, if i can mix those 2 normally it should work, right? or maybe there is another way to show random image in the Code: [Select] [i] if(empty($first_img)){ //Defines a default image[/i] [b] $first_img = ? ok, this is a much shorter version, but i have: Code: [Select] $val = "1"; then i have a function Code: [Select] function include_function_name{ echo' <ul><li> <a href="index.php?pageID="{$val}"">page name</a> <li/><ul/>'; } i have tried all sorts of variations but i can get it to make pageID=1 plaease help thanks ricky I looked up 'how to get all POST variables' and I ended up putting this bit of code together. Im not experienced at all with OOP programming, but I think that when '=>' is used its to do with OOP? Anyway. I dont get this code. I understand Foreach $_POST, as $someVar, (BTW im looking for checkboxes from a form), However, If I leave out the '=> $val' I simply get a lot of 'on' values, indicating the checkboxes I checked. However, WITH the '=> $val' I end up with the checkbox name. Now i've changed the name of '$val' so i know its not a keyword. But i dont get it. Is there a way to access the value of the checkbox? Can someone explain to me whats going on here? I know that I can get the value of the checkbox by $_POST['$checkRows'] But, I have a feeling It can be done in the foreach line. foreach($_POST as $checkRows => $hip) { echo "POSTED: $checkRows<br>\n"; } Please help! |