Jump to content

phpbeginner

Members
  • Posts

    214
  • Joined

  • Last visited

Everything posted by phpbeginner

  1. You lost me with sprintf.......so can anyone help me or know why my code is not working? Thanks In Advance. $subtotal = ROUND ('1.0000' * ($row[2] + $row[3] + $row[4]), 4) ;
  2. Trying to round math to 4 decimal places but cuts of if it ends in 0's. For example want to display 1.9800 but displays as 1.98 Here is my round code $subtotal = ROUND ('1.0000' * ($row[2] + $row[3] + $row[4]), 4) ;
  3. Hi Barand, I got it to work using the following. $flooring=$_POST["flooring"]; $flooringstr=""; for($i=0;$i<sizeof($flooring);$i++){ $flooringstr .= $flooring[$i]." ";} and changing value to ($flooringstr). NOW, I having a tremendous amount of difficulty with populating the checkboxes on my edit page. I am inserting the values in a text type field, and as you can see, seperated by a space. Any ideas on this one? Appreciate your help.
  4. I dunno.....will still only insert 1 selection
  5. Form..... <input type=checkbox name=flooring[] value=Hardwood> Hardwood <input type=checkbox name=flooring[] value=Carpet> Carpet <input type=checkbox name=flooring[] value=Linoleum> Linoleum Then if ($action=="go") { $flooringCount = count($flooring); for ($i=0; $i < $flooringCount; $i++) $query = "INSERT INTO styles (flooring) values($flooring[$i])
  6. Tried option 1 which I was trying to achieve but still just adds ARRAY to the fldflooring
  7. I changed the value to $flooring[$i] and added this but will not insert anything..... $flooringCount = count($flooring); for ($i=0; $i < $flooringCount; $i++);
  8. I am using a form to update my database and within the form there are a large number of fields which I update on GO. Within that form one of the fields I am updating, I would like to have a multiple selection choice for that field as below. <input type=checkbox name=flooring[] value=Hardwood> Hardwood <input type=checkbox name=flooring[] value=Carpet> Carpet <input type=checkbox name=flooring[] value=Linoleum> Linoleum Now when I submit go there are all kinds of things I am inserting including flooring $query = "INSERT INTO styles (flooring) values($flooring) But in the database all that is inserted is ARRAY. Also, what is the best field type to insert multiple selections in? Thanks In Advance
  9. I'm really lost on this one.....as you can probably tell
  10. Here is what I now have but can't get these to update or move.......any help would be appreciated, as usual. " . $rowTest[2] . " = position $rsTest=mysql_query("select * from tbltest ORDER BY position"); $position++; if($rsTest) { echo("<table>"); while($rowTest=mysql_fetch_row($rsTest)) { echo("<tr><td width='350'><p>"); echo("<strong><a href=savetest.php?numTest=" . $rowTest[0] . ">" . $rowTest[1] . "</a> : <a href='addedittest.php?move=" . $rowTest[2] . "&to=($position-1)'>move up | <a href='addedittest.php?move=" . $rowTest[2] . "&to=($position+1)'> move down</a></strong>"); echo("</p></td>"); echo("</tr>"); echo("</td></tr>"); } echo("</table>");
  11. Any place you could direct me would be great. The actual table structure is currently pretty basic.... id (auto-increment) title paragraph uploadedfile Say I have 10 records (id 1 - 10) and when I log in, these are all displayed, I would like, as an example, move id 2 to id 1, or id 10 to 7. If you could point me in the right direction, I would appreciate it.
  12. I have been doing some searching but have not found a clear solution yet so I look for some direction. I have a CMS (php/MySQL). Currently, the records from any of my tables are displayed by ID (auto-increment). When I log in and I select a list of records from a specific table and they are listed, I would like to be able to adjust these in any order I want (move up/ move down). Can someone point me in the right direction? Thanks so much.
  13. I appreciate that and had thought about my options and changing to a number as unfortunately I have a limit clause also so that's why I was looking for some help in here as I knew it would be a bit more complicated. I thought I had planned the database to the fullest as it was simply going to be order by price....however a change in plans on the client end. I appreciate all your help and insight GingerRobot. All the best in 2008!
  14. Thanks, but not working for me.....and your absolutely right, I do not get it. I have no idea why the form. I don't want the end user to query results by Featured, Coming Soon, Regular or Sold. I am just trying to get the results to query in that order (All Featured 1st, All Coming Soon 2nd, All Regular 3rd, All Sold 4th). I apologize for my ignorance on this.
  15. $sortby = $_POST['Featured','Regular','Coming Soon','Sold'] $query = "SELECT * FROM tblproduct where type='Truck' ORDER BY ".$sortby; Yeah, this is what I have been trying but no go.....
  16. bump.....anyone help me with this? Appreciate it !
  17. Ahh, I already have the form inserting this into the database. I am trying to display it in the order above.
  18. Ouch, what a mess I got now.....I guess I am way off on my assumption above.
  19. Thanks for your replies, I have never got this far into this. So I would simply use.... $sortby = $_POST['Featured','Regular','Coming Soon','Sold'] $query = "SELECT * FROM tblproduct where type='Truck' ORDER BY ".$sortby; Again, Thanks So Much and Happy New Year to All !
  20. Without getting into 4 different results or queries, is there an easy way to sort by status the way I want. For example I would like to order them by status as follows (Featured, Regular, Coming Soon and Sold). $query = "SELECT * FROM tblproduct where type='Truck' ORDER BY 'status'"; $result = mysql_query("SELECT * FROM tblproduct where type='Truck' ORDER BY `status` LIMIT $limitvalue, $limit;"); Thanks So Much and Happy New Year!!
  21. That's what I was reading on and where I went originally. I can't get any of my data to load. Even if I could get the addresses to load would be a plus.
  22. Never done this before .....how do I go about setting the other columns on the fly ? I have looked it up (LOAD DATA LOCAL INFILE) but don't seem to be having any luck with it.
  23. I have a client who I am building a newsletter for and have a database built for the e-mail addresses, etc..The table has 4 fields (id,address,validate,nlid). The client sent me a loooonnnngggg list of addresses on notepad only seperated by a line break. Is there an easy way to take this notepad file and insert the addresses into the table where column=address ? Thanks in Advance P.S.- there are 4 lists so for each list I insert the id is auto increment, address is from the lists, validate will = 1 and nlid will be 1,2,3, or 4 depending on the list I am inserting.
×
×
  • 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.