Jump to content

Search the Community

Showing results for tags 'format'.

  • 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 7 results

  1. In php number format function works like.... number_format("1000000",2); // 1,000,000.00 is there a way to format numbers like... 10,00,00,000 (from right. No decimal. First comma after 3 digits and then commas after every 2 digits)
  2. Hello - hope you are all well. I am creating a website for a family friend who has a shop. See preview of the site in this picture .... Currently the results are showing in one column. I want to show them in three columns in the format of: 1 2 3 4 5 6 7 8 9 etc But formatted with the picture and then the title and the border. The current code i have is.... HEAD <?php $sql = "SELECT * FROM abs_productcat WHERE catid = $catid ORDER BY catid ASC"; $can = mysql_query($sql); $catname = mysql_fetch_assoc($can); ?> BODY <?php while ($row_pro = mysql_fetch_assoc($rs_proddetails)) { ?><tr> <td><table width="243" border="0" align="left" cellpadding="15" cellspacing="0" class="sectionborders"> <tr> <td height="120" align="center"><p><strong><a href="indproducts.php?ProductID=<?php echo $row_pro['ProductID']; ?>"><img src="products/product_<?php echo $row_pro['ProductID']; ?>" alt="<?php echo $row_pro['ProductName']; ?>" height="120" class="sectionborders" border="0" /></a></strong></p> <p><strong><a href="indproducts.php?ProductID=<?php echo $row_pro['ProductID']; ?>" class="products"><?php echo $row_pro['ProductName']; ?></a></strong></p></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <?php } ?> THANK YOU FOR YOUR HELP!!!
  3. Hello, I am new to this site so please execuse my ignorance, I have piece of code that returns a time of 00:00:00 however I only want it to return 00:00. ie. 00:11:56 instead of 11:56. Can anyone help Thanks Time commenced: <select name="time_commenced" id="time_commenced"> <option value="<?php echo date('Hi'); ?>"><?php echo date('Hi'); ?></option> <?php $start = strtotime('0700'); $end = strtotime('2000'); ?> <?php for ($i = $start; $i <= $end; $i += 360) { ?> <option value="<?php echo date('Hi', $i); ?>"><?php echo date('Hi', $i); ?></option> <?php } ?> </select> Time completed: <select name="time_completed" id="time_completed"> <option value="<?php print date("Hi", mktime()+(6*60)); ?>"><?php print date("Hi", mktime()+(6*60));?></option> <?php for ($i = $start; $i <= $end; $i += 360) { ?> <option value="<?php echo date('Hi', $i); ?>"><?php echo date('Hi', $i); ?></option> <?php }
  4. Hello all! I want to format my post array so that I can insert the data into the database in a particular way such as this: Also, I'm making this dynamic in that I'm not always going to know the column names. So hardcoding the keys is not an option for this solution. INSERT INTO invoice_items (itemCode, itemDesc, itemQty, itemPrice, itemLineTotal) VALUES (1000', Widget0', 10', '25.00', '900.54), (1001', Widget1', 11', '25.01', '900.54), (1002', Widget2', 12', '25.02', '900.54) BUT my current output looks like this. Which is not right of course: INSERT INTO invoice_items (itemCode, itemDesc, itemQty, itemPrice, itemLineTotal) VALUES (1000', '1001', '1003), (Widget', 'Red Hat', 'ioPad with Cover), (1', '2', '3), (100.5', '25.02', '300.18), (25.02', '600.36', '900.54); I don't think I'm that far from having a solution but I can't wrap my head around how to get the output the way I need it. The original $_POST Array: Array ( [itemCode] => Array ( [0] => 1000 [1] => 1001 [2] => 1003 ) [itemDesc] => Array ( [0] => Widget [1] => Red Hat [2] => ioPad with Cover ) [itemQty] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [itemPrice] => Array ( [0] => 100.5 [1] => 25.02 [2] => 300.18 ) [itemLineTotal] => Array ( [0] => 100.50 [1] => 50.04 [2] => 900.54 ) ) Here's the loop that creates the following arrays: $fields = $values = array(); foreach ($post as $column => $value) { $fields[] = $column; $value = implode("', '", $value); $values[$column] = $value; } $columns Array: Array ( [0] => itemCode [1] => itemDesc [2] => itemQty [3] => itemPrice [4] => itemLineTotal ) $values Array: Array ( [itemCode] => 1000', '1001', '1003 [itemDesc] => Widget', 'Red Hat', 'ioPad with Cover [itemQty] => 1', '2', '3 [itemPrice] => 100.5', '25.02', '300.18 [itemLineTotal] => 25.02', '600.36', '900.54 ) Create the sql statement: $query = "INSERT INTO " . $this->table ; $query .= " (" . implode(", ", $fields) . ") "; $query .= "VALUES (" . implode("), (", $values) . "); "; Which outputs this: INSERT INTO invoice_items (itemCode, itemDesc, itemQty, itemPrice, itemLineTotal) VALUES (1000', '1001', '1003), (Widget', 'Red Hat', 'ioPad with Cover), (1', '2', '3), (100.5', '25.02', '300.18), (25.02', '600.36', '900.54); THANK YOU for any help you can provide me!
  5. Hi I want to make a table that has table rows like this: There are 3 horses in the sky. There are 4 cows in the stable. There are 5 dogs in the sea. The numbers, the animal names and the places have to be placed neatly below each other, so therefore I probably need to use the <td></td>. I tried using the printf ($format, $number, $animal, $place) function, and the array's $number=array(3,4,5); $place=array(sky,stable,sea); $animal=array(horses, cows, dogs); But I only get one tablerow that says (, There are, Array, Array, in the, Array); Can anyone please tell me what code I have to use to make this? Thanks already.
  6. So people submit some text to a SQL database using a form. it goes to the database as it should. When people press enter it actually shows it as a new line. But using the php to recall the information it will not show it like that. So for an example "I need a new car. I like puppies." Looks like "I need a new car. I like puppies." How do I fix this so it displays like they want it to look?
  7. Hello Everyone, Haven't been here in a while. This looks new and cool! Anyway, I have PHP output an array of numbers as an average and that worked fine. I got the number -.0111523. Which is exactly what I want. They only problem is that I need the number to look like this -.011. I tried to use the number format command, but that did not work. Just slapped a couple of zeros onto the end. Any suggestions? Thanks in advance!
×
×
  • 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.