Jump to content

OGBugsy

New Members
  • Posts

    8
  • Joined

  • Last visited

OGBugsy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I have a form that submits data to a mysql db. It's working fine. What I am trying to do is output an html page (or possibly 2) that is propagated with the data that I just sent to the db. example: when I submit a new workorder, a page comes up with all the data i just submitted. so that can be printed as a "customer copy". and in a perfect world, another page comes up that is a material order form. That can be faxed to my vendor to order the materials for that job. Not looking to auto print or fax anything. I am just having trouble getting the data into my html page. Here is what I have, but sadly is not working. <?php $link = mysqli_connect("xxxx", "xxxx", "xxxx", "xxxx"); $sql = "SELECT customer FROM jobs WHERE id=6487"; echo $sql; mysqli_close($link); ?> I would like to use the data from the last id submitted and have tried several things like: WHERE id=mysqli::$insert_id and WHERE id=$insert_id with no luck. Here is a pic of the html form and the output i'm getting. Any help would be greatly appreciated. Thanks in advance. OGBugsy
  2. I am just using a MySQL db field named date with an auto timestamp. it displays like - 2015-04-15 11:07:03 not quite sure on how to use your code, still learning. Do you mean I should format the date the way I want it before it's sent to the db? Like with the rest of the form data and not use the timestamp?
  3. I have a function i'm building and I would rather not have it return the year or the seconds. Is there a way to format the date output when I echo this function? function estOptions($db) { $opts = "'<option value=''>- New Estimates -</option>\n"; $sql = "SELECT id, customer, salesman, status, location_address, date FROM jobs ORDER BY status"; $res = $db->query($sql); while (list($id, $customer, $salesman, $status, $location_address, $date) = $res->fetch_row()) { $opts .= "<option value='$id, $customer, $salesman, $status, $location_address, $date'>$id, $customer, $salesman, $status, $location_address, $date </option>\n"; } return $opts; } I was wanting to format it like: date("jS F h:i A") Any help would be greatly appreciated, thanks! OGBugsy
  4. You sir, are a Saint !! That is exactly what I was hoping for and I understand it a lot better now to boot. Many thanks and a bunch of good karma your way! PS - I am from Texas but I visited Portsmouth Harbor in 1984 via the US Navy. Very beautiful country you have there. I always dreamed of taking my wife back. Hopefully someday. Cheers!
  5. Here is another attempt at it, just trying to populate with "last_name" only. $db = new mysqli(localhost,xxxxx,xxxxx,xxxxx); function salesmenOptions($db) { $opts = "'<option value=''>- select last_name -</option>\n"; $sql = "SELECT id, last_name FROM salesmen ORDER BY last_name"; $res = $db->query($sql); while (list($id, $las) = $res->fetch_row()) { $opts .= "<option value='$id'>$las</option>\n"; } return $opts; } thanks, OGBugsy
  6. Thank you for the response and the code. I decided to try the code on the simplest table I have "salesmen". I would like the selectbox to pull up the salesmen "last_name" and "first_name", did I edit the code correctly? +----------------------+------------+ | id | first_name | last_name | +----+-----------------+------------+ | 1 | dave | walker | | 2 | pete | smith | | 3 | sam | jones | +----+-----------------+------------+ $db = new mysqli(localhost,XXXXXXXX,XXXXXXXXX,XXXXXXXX); function salesmenOptions($db) { $opts = "'<option value=''>- select salesmen -</option>\n"; $sql = "SELECT last_name, first_name FROM salesmen ORDER BY last_name"; $res = $db->query($sql); while (list($last_name, $first_name) = $res->fetch_row()) { $opts .= "<option value='$last_name'>$first_name</option>\n"; } return $opts; } <html> <body> <select name='salesmen'> <?php echo salesmenOptions($db); ?> </select> </body> </html> I have put the code into my html doc with no problem. But, I am having trouble creating the "function" in phpmyadmin (I have never done this before). I tried to use the "Routines" tab to create the function but I am having no luck. I honestly tried to figure it out thru google searches but I am at the hair pulling point atm. Any help in pointing me in the right direction or tips on creating the function with phpmyadmin would be very appreciated. Thanks, OGBugsy
  7. Hello, new to the forum and was hoping to find a little help. I have a database and form set that I built with MySQL, html and php. I can submit new data, search and view the db fine from all the forms. what I am trying to do is have a form select box auto fill with the contents of a table/row. like an "active" select box example: I have a workorder form and I would like the form to have a select box that can choose from a list of materials that are populated in another table. So When I add a new material, it will show up in the forms select box. is there a way to accomplish this? Many thanks in advance. OGBugsy
×
×
  • 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.