Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Everything posted by phpretard

  1. <meta http-equiv="Page-Enter" content="blendTrans(Duration=.1)">
  2. The problem is with the Zero not showing up. The round() works fine. If the second number defined by the 2 in round($var, 2) is = to Zero it will not display the Zero.
  3. Howdy, I have a little problem... $grandtotal="195.20264"; round($grandtotal , 2); This only displays: 195.2 My problem is I need the "0" to show up as well : 192.20 How can I fix this? Anybody know?
  4. I am new to arrays but I have managed to develope a way to make this one. My problem is how to serialize all of it into one big bowl of serial. I do know this $myArray=serialize(WHAT GOES HERE?); //Specifically for this array Array ( [myusername] => Administrator [invoice_items] => Array ( [0] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => [Quantity] => 100 [item] => Envelopes [Description] => ) [1] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 175.98 [Quantity] => 100 [item] => Letterhead [Description] => ) [2] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 226.97 [Quantity] => 100 [item] => Tri-Fold-Brochure [Description] => Full Color | Front And Back ) [3] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 115.98 [Quantity] => 100 [item] => Rack-Cards [Description] => ) [4] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 74.94 [Quantity] => 420 [item] => Return-Labels [Description] => ) [5] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 74.94 [Quantity] => 420 [item] => Return-Labels [Description] => ) [6] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 135.98 [Quantity] => 100 [item] => Flat-Invitation [Description] => ) ) [invoice_number] => 478849 ) I sure hope someone can help with this.
  5. That does't display anything (BTW i did see the "}" missing)
  6. Maybe a better question would be how do I unset... [3] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 175.98 [Quantity] => 100 [item] => Letterhead [Description] => Welcome Letter Standard Paper ) ...if I needed to.
  7. Sweeeeet! Just one more thingy. How do I display the [0] or the [1] etc... part of this: [0] => Array I think it's the $key but for the purpose of unseting peices of the array i need to identify that value.
  8. This Code Only Displays One Array Value. Icant figure out where to put the $a++ if that is what I am Suppost to do. $a=0; foreach ($_SESSION as $lineItem => $val){ echo" <table border=1 width=100%> <tr> <td> ".$_SESSION[$lineItem][$a]['Item']." </td> </tr> </table>"; } Array ( [myusername] => Administrator [invoice_number] => 447425 [invoice_items] => Array ( [0] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 226.97 [Quantity] => 100 [item] => Tri-Fold-Brochure [Description] => Full Color | Front And Back ) [1] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 115.98 [Quantity] => 100 [item] => Rack-Cards [Description] => Inventory Sheet ) [2] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 135.98 [Quantity] => 100 [item] => Flat-Invitation [Description] => Signature Cards ) [3] => Array ( [COName] => ENS Metals and Jewelry, Inc. [Cnumber] => 156882 [Price] => 175.98 [Quantity] => 100 [item] => Letterhead [Description] => Welcome Letter Standard Paper ) ) ) I need to display all of the ".$_SESSION[$lineItem][$a]['Item']." Any Help?
  9. Yes It Goes on the page and doesn't look right.
  10. Or maybe I don't know what a batch replace is.
  11. I really didn' want it to display an underscore.
  12. I knoe I Made A Slight Mistake When I Named A Batabase Table With A Space In The Name. Isn't there a work around for that. It's kind of too late for me o go and change the whole thing around. $row="No Good"; $result = mysql_query("SELECT * FROM $row "); Thank you for your help.
  13. I dont intentionally set cookies does tht mean anything?
  14. Are you getting a caN'T REDIRECT BLAH BLAH BLAH?
  15. What's a paginate suppost to do? I have never heard of it. Gt a link or something or is it simple to explain?
  16. It seems that when I logout of my site that all of the sessions don't clear. Is thee a way to be 100% sure your sessions are gone? I say this because when I click the Log out button it directs you to the login screen. Well I have to enter my user ans pass twice to get back in every time. session_start(); $_SESSION = array(); session_destroy(); This is what I think does it. Anyone heard of this before...the part about having to log back in twice?
  17. I would like to setup an Array from a database for a pricing structure. Thanks to the wonderfully selfless people in this forum I have a much better understanding of arrays. THANK YOU ALL! $sql = "SELECT * from pricing"; $result = mysql_query($sql,$con); while ($property = mysql_fetch_field($result)) { $price[$property ->name]=$name; } print_r($price); The Above Gives Me The Field Values: Array ( [id] => [Postcards] => [brochures] => [Car Door Magnets] => [Rack Cards] => [Flyers] => [Folders] => [Magnets] => [Hats] => [T-Shirts] => [Pens] => [Tri-Fold Brochure] => [Door Hangers] => ) The array below I just filled in manually to demenstrate my objective. The dollor amounts you see are the values in the database fields. My problem is I can't get them to show up in the array. Array ( [id] => 1 [Postcards] => 10.00 [brochures] => 25.00 [Car Door Magnets] => 36.00 [Rack Cards] => 60.00 [Flyers] => 50.00 [Folders] => 30.00 [Magnets] => 5.00 [Hats] => 15.00 [T-Shirts] => 20.00 [Pens] => 1.00 [Tri-Fold Brochure] => 65.00 [Door Hangers] => 25.00) PS If you know of a better wat to set up a database that contains products and pricing I am open for suggestions.
  18. Just On More Thing. This makes a seperate array for each post. Is there a simple fix to put them all into one array from the code you see here? foreach($_POST as $key => $val){ $invoice=array($key => $val); print_r($invoice); } Array ( [customer] => ENS Metals and Jewelry, Inc. ) Array ( [category] => Marketing Material ) Array ( [product] => Tri-Fold Brochure ) Array ( [Cnumber] => 156882 ) Array ( [Qty] => ) Array ( [item] => Marketing Material ) Array ( [Description] => Tri-Fold Brochure | Full Color ) Array ( [Cost] => ) Array ( [Date] => 05-08-2008 ) Array ( [Paid] => )
  19. Did this help in understanding my problem?
  20. This is straight from one of my pages and it owrks fine. Hope It Helps <? if(!isset($_SESSION['username'])){ echo" <div id='links'> <a $login href='?page=secure/main_login'>LogIn</a> ////////LOGIN IF THERE IS NO SESSION </div> "; } elseif(isset($_SESSION['username'])){ echo" <div id='links'> <a href='?page=$page&action=logout'>Logout</a> ////////LOGOUT IF THERE IS A SESSION </div> "; }
  21. Here is what my inexperience has come up with: MY FORM: <form action='POST PAGE' method=post> <input type=text name='Cnumber' value='123456'> <input type=text name='Qty' value='10'> <input type=text name='Item' value='Marketing Material'> <input type=text name='Description' value='Two Sides | Full Color'> <input type=text name='Cost' value='125.00'> <input type=text name='Date' value='May 8, 2008'> <input type=text name='Paid' value='0'> <input type=submit name=submit> </form> POST PAGE: //Basically I Would Like to store all of the posted information into an array and insert it into the database. I think the code goes something like this but I know it's probably way off. if (isset($_POST['submit'])){ $Cnumber=$_POST['Cnumber']; foreach($_POST as $key => $val){ $invoice= array($key => $val); } include '../../../../connect.php'; mysql_query("INSERT INTO invoices (id, Cnumber, invoice) VALUES ('', '$Cnumber', '$invoice')"); }
  22. I really appreiciate your patients with my ignorance. Sometime the answers given are clear to me and sometimes they are not. Beleive me I have read many tutotials on arrays and the one problem I have is pulling just one value from an array. I truly follow the terms of this sight. Please Let me give you the full detail of this project... I am using a form and posting it to a page to build an array and store that array into a databse. Later it will be called to populate cells (<td>) in a table (<table>). MY FORM: <input type=text name='Cnumber' value='$cn'> <input type=text name='Qty' value=''> <input type=text name='Item' value='$p'> <input type=text name='Description' value='$I | Full Color'> <input type=text name='Cost' value=''> <input type=text name='Date' value='$today'> <input type=text name='Paid' value=''> POSTED TO: $Cnumber=$_GET['cn']; $invoice = $_POST['file']; foreach($_POST as $key => $val){ $_SESSION[$invoice][$key] = $val; } //CLOSE FOR EACH $cost=serialize($_SESSION); include 'connect.php'; mysql_query("INSERT INTO invoices (id, description) VALUES ('', '$cost')"); THIS ALL WORKS. My prblem is getting them later into the cells mentioned earlier. MY LASTEST ATEMPT: $result = mysql_query("SELECT * FROM invoices WHERE Cnumber='123456'"); while($row = mysql_fetch_array($result)) { $test=unserialize($row['description']); print_r(array($test)); } My Attempt Yields: Array ( [0] => Array ( [] => Array ( [customer] => ENS Metals and Jewelry, Inc. [category] => Marketing Material [product] => Tri-Fold Brochure [Cnumber] => 156882 [Qty] => [item] => Marketing Material [Description] => Tri-Fold Brochure | Full Color [Cost] => [Date] => 05-08-2008 [Paid] => ) ) ) I only need the items such as :"ENS Metals and Jewelry, Inc" AND "Marketing Material" Basically the values. I could be setting up the array wrong in the first place (like you said). Can you show me a better way. It seems the tutorials and scripts I find don't seem to apply to what I am doing am therfore confuse me. If you choose to help please explain as well. I appreciate it !! -Anthony
  23. I can work with arrays. I am trying to get it unserialzed back into the array format I am familiar with.
  24. I am testing this: $result = mysql_query("SELECT * FROM invoices"); while($row = mysql_fetch_array($result)) { $test=unserialize($row['description']); echo $test; } And all I get is: Array
×
×
  • 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.