PHP - Change Money Format
How can I make $10.58 round up to $11?
Right now my code makes $10.58 into $1,058 Code: [Select] if (preg_match_all('#([0-9]+)#', $_POST['capitalrequestedas'], $matches) > 0) { $capitalrequested = implode($matches[1]); } else { $capitalrequested = 0; } Similar TutorialsI need to change the date format to DD-MM-YYYY. Please help. $SomeVar = $_POST['finco']; $query = "SELECT * FROM news_home WHERE code = '".$SomeVar."' ORDER BY timestamp DESC"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line["subject"].",,".$line["timestamp"].",,".$line["News"].",,".$line["links"].",,,"; } echo $returnS; mysql_close($link); ?> Hi i've been trying to change the format of the date which comes from the database row [ news-date ] this what i tried but di not work help please $query = "SELECT * FROM news, date_format [news_date](date,'%M %d, %Y') AS news_date "; $result = mysql_query($query); // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes so print them one after another echo "<table cellpadding=10 border=1>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>".$row["news_id"]."</td>"; echo "<td>".$row["subject"]."</td>"; echo "<td>" .$row['news_date']. "</td>"; echo "<td>".$row["news_artical"]."</td>"; echo "<td><a href=delete2.php?id=".$row["id"].">Delete</a></td>"; echo "<td><a href=modifyform.php?id=".$row["id"].">Modify</a></td>"; echo "<td><a href=add.php?id=".$row["id"].">Add Row</a></td>"; echo "</tr>"; } //End While echo "</table>"; } //End if rows echo "<p> <strong>{news.SUBJECT} </strong></p>"; ?> Hi, I am importing data from a csv file into mysql. Everything works fine except that the 'order_date' column in CSV is in the following format mm/dd/yy. Upon import I would like for that format to be changed to yyyy-mm-dd I am not sure how to modify the following code to be able to do so. Any help would be appreciated. <? include "connect.php"; if(isset($_POST['submit'])) { $filename=$_POST['filename']; $handle = fopen("$filename", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $date = date("Y-m-d"); $import="INSERT into table (order_id, order_status, order_date, todays_date) values ('$data[0]', '$data[1]', '$data[2]', '$date')"; mysql_query($import) or die(mysql_error()); } fclose($handle); print "Import done"; } else { print "<form action='importnew.php' method='post'>"; print "Type file name to import:<br>"; print "<input type='text' name='filename' size='20'><br>"; print "<input type='submit' name='submit' value='submit'></form>"; } ?> I pass a variable (date) which contains the date in format of 03-02-2011 (m-d-Y) how could i quickly change that date format to show 02-MAR-2011 (d-M-Y) Is there a function that can quick do this? Hi everyone, newbie to site looking for help with my tag/category page formatting.
I recently bought a plugin for masonry and have been trying to make it the display for posts on my blog pages as you can see he http://www.enduringepilepsy.com/_blog/ and http://www.enduringe...m/archive/_2013
It's been helping my design and page load overall (Note: I do use Google Page Speed Service)
But I cannot figure out how to be able to use this customizable masonry for my tag/category pages since they do no show the ability to edit on the Wordpress admin bar.
I've looked at the php code in my files, and while I have become more familiar with php in the yr since I moved to Wordpress, am unsure how to edit these pages without making a mess.
The plugin is http://codecanyon.ne...-plugin/7563340 My theme, called Inzin, is no longer sold, and the developer disappeared from online. So I have lost all support. I would really appreciate any help anyone could offer. Thank you!
Hello there, I'm having a problem displaying money correctly with php. I have a field called "balance" with the type float(10,2), in this field I have a number store as "34.55" which I can go in and look at within phpmyadmin but when I echo this value on the front-end of the site it is displayed as "34.549999237061" Can someone please help? Regards.
Hello All, function convertTimeFormat($time12Hour) { // Initialized required variable to an empty string. $time24Hour = ""; // Used explode() function to break the string into an array and stored its value in $Split variable. $Split = explode(":",$time12Hour); // print_r(explode (":", $time12Hour)); => Array ( [0] => 09 [1] => 50 [2] => 08AM ) // Retrieved only "hour" from the array and stored in $Hour variable. $Hour = $Split[0]; $Split[2] = substr($Split[2],0,2); // Used stripos() function to find the position of the first occurrence of a string inside another string. if($Hour == '12' && strpos($time12Hour,"AM")!== FALSE) { // Code here } elseif(strpos($time12Hour,"PM")!== FALSE && $Hour != "12") { // code here } return $time24Hour; } $time12Hour = "09:50:08AM"; $result = convertTimeFormat($time12Hour); print_r($result); /* Input : "09:50:08AM"; Output : "21:50:08PM"; */
Maybe some experienced people could be letting me know when it comes this?
I thought of a "file storage" web app like "YouSendIt", I also thought of a "web host" web app as a "reseller".
With this I am getting caught up in thoughts, that the traffic could not happen.
Is there something, where one could be more "sure" that the traffic may happen, and with this the "clicks" too, even if it are a $100 or $200 per month?
I would appreciate the suggestions a lot.
Can PHP working for money transfer online? Any simple code for this? Thank you Hi all, I am currently making a website that has e-custom functions and a back end for the client. I want them to be able to upload images - but they need to be transparent. I do not want to leave this in the hands of the client, so I am looking at ways of using the GD library to make the change I got no issue with the png/gif type for upload/resize function since this type already transparent background but my major problems is how to deal with jpeg/jpg image type which is their background was not a transparent...so is it possible I can change/ convert to png/gif type upon successful of uploading image...so the new final image will be png/gif type with transparent background...is it doable...I am not even sure it is possible...? Thanks for any help.. i want to make virtual money (credits, tokens) whatever you want to call it but make no mistake this is not for profit at this point but i like the concept of visitors having something to do with other members of site for example to kill bordom and create a reason to play games, compete in competetions, it will have to conversion to real money at this point but i wish to do this script using php and mysql and have very basic coding skills in these areas anyone please help me make this script... reply and let me know if you like this idea please help me as this is achievable as fb has it and more sites are moving toward these same ideas, even tho fb is real money it is more to do with fun at this point until we do this stage another stage canot proceed it. echo "<font color='000000'>No Service Found At<br /></font>"<font color='000000'> .long2ip($ip)</font>; Hi im desperately in need of some help here.. Im exporting my html page data to csv but i am unable to get the data onto a new column the code is as follows HTML FORM Code: [Select] <form id="form1" name="form1" method="post" action="index.php"> <table class="formatTblClass"> <tr> <th colspan="6"><?=$message;?></th> </tr> <tr> <td width="68"><span>First Name</span></td> <td width="215"><input class="Name" type="text" name="fn" id="fn" /></td> <td width="62"><span>Last Name</span></td> <td colspan="3"><input class="Name" name="ln" type="text" id="ln" size="50" /></td> </tr> <tr> <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="71">Address</td> <td width="721"><input class="Address" name="address" type="text" id="address" size="100" /></td> </tr> </table></td> </tr> <tr> <td><span>City</span></td> <td><input class="City" type="text" name="city" id="city" /></td> <td><span>State</span></td> <td width="148"><input class="State" type="text" name="state" id="state" /></td> <td width="24"><span>ZIP</span></td> <td width="255"><input class="ZIP" type="text" name="zip" id="zip" /></td> </tr> <tr> <td><span>Phone</span></td> <td><input class="Phone" type="text" name="phone" id="phone" /></td> <td><span>Email</span></td> <td><input class="Email" type="text" name="email" id="email" /></td> <td><input name="emailMe" type="checkbox" id="emailMe" value="Yes" checked="checked" /></td> <td>Please send me email</td> </tr> <tr> <td colspan="6"><span>Comments <textarea name="comments" id="comments" cols="45" rows="5"></textarea> </span> <div align="center"> <input type="submit" name="Submit" id="Submit" value="Submit" /> <input type="reset" name="Reset" id="button" value="Reset" /> </div></td> </tr> </table> </form> <?php // Receiving variables @$pfw_ip= $_SERVER['REMOTE_ADDR']; @$fn = addslashes($_POST['fn']); @$ln = addslashes($_POST['ln']); @$address = addslashes($_POST['address']); @$city = addslashes($_POST['city']); @$state = addslashes($_POST['state']); @$zip = addslashes($_POST['zip']); @$phone = addslashes($_POST['phone']); @$email = addslashes($_POST['email']); @$emailMe = addslashes($_POST['emailMe']); @$comments = addslashes($_POST['comments']); // Validation //saving record in a text file $pfw_file_name = "formtest.csv"; $pfw_first_raw = "fn,\rln,\raddress,\rcity,\rstate,\rzip,\rphone,\remail,\remailMe,\rcomments\r\n"; $pfw_values = "$fn,\r$ln,\r$address,\r$city,\r$state,\r$zip,\r$phone,\r$email,\r$emailMe,\r".str_replace ("\r\n","<BR>",$comments )."\r\n"; $pfw_is_first_row = false; if(!file_exists($pfw_file_name)) { $pfw_is_first_row = true ; } if (!$pfw_handle = fopen($pfw_file_name, 'a+')) { die("Cannot open file ($pfw_file_name)"); exit; } if ($pfw_is_first_row) { if (fwrite($pfw_handle, $pfw_first_raw ) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } } if (fwrite($pfw_handle, $pfw_values) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } fclose($pfw_handle); echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>thanx</font></p>"); ?> THIS IS THE OUTPUT I GET fn ln address city state zip phone emailMe comments Tom Sawyer shady lane new york new york NY124 123456789 tom@sawyer.com Yes comments THIS IS THE OUTPUT I AM LOOKING FOR fn Tom Harry ln Sawyer Potter address shady lane magic lane city new york xyz state new york xyz zip NY124 12343 phone 123456789 987654321 email tom@sawyer.com harry@magic.co.uk emailMe Yes Yes comments comments this is the comment please help me on this one.. unable to get the script export the data in top to bottom columnwise format Hey, I have always wondered if there is a correct way of displaying variables inside html. Typically I would echo each variable inside php tags when displaying outside of a loop but what would you recommend for a while loop while more than say 5 variables to display? Code: [Select] echo "<tr><td>".$var1."</td></tr>"; OR Code: [Select] <tr><td><?php echo $var1; ?></td></tr> I have my array like so Code: [Select] $inaque = array("'$dir'"=>"'$company'"); When I run Code: [Select] print_r($inaque); It shows like Code: [Select] Array ( ['share_what_you_want'] => 'Share What You Want' ) How can I get this array to print out like Code: [Select] array ( 'share_what_you_want' => 'Share What You Want' ) Without the [ ] This is the format that is needed for this code that has already been written by somebody else. Thanks in advance Hi Guys
In MYSQL the date format seems to be YYYY-MM-DD, when I use a dynamic table in Dreamweaver the date is also displayed this way, is there a simple way to change this to UK format DD-MM-YYYY?
how can I have this pull records of = or < userlevel SELECT * FROM site_jobs WHERE level_required ='$userlevel I want it to pull records that are also < that $userlevel I have my date set in my database as: 2010-12-13 08:00:00 What I would like to do is use PHP to format the date when pulled out the database to say: December 13, 2010. I really do not need the time if we can toss that. I wish it was as easy as changing info in the database directly, but with teh way everything has been programmed, it would be too much work. Here is an example: $data = mysql_query("SELECT * FROM jos_jevents_repetition") or die(mysql_error('Error connecting to the database')); while ($row = mysql_fetch_array($data)) { echo "<label for='name'>Dates</label>", "<select type='text' name='name'>", "<option value=''>Please Select A Date </option>", "<option value='".$row['startrepeat']."'>".$row['startrepeat']." </option>", "</select>"; } |