Jump to content

NiallThistle

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by NiallThistle

  1. That's excellent, thank you very much.
  2. PHP v4 The date could be anything, but the info is taken from three drop downs (day, month and year) in a form on the previous page.
  3. I was actually reading that very site about an hour ago. Can't make head nor tail of it, in terms of context, how I should adapt what I have. Essentially what I have just now is: echo"$date"; And that outputs the basic SQL entry format of '0000-00-00'. Can anyone suggest a basic way to write the line I wrote above, to add formatting to the date?
  4. I'm going round in circles with this one, but I have a feeling that the answer is obvious. I have POST information that I want to use as a date and display it using date format, but I don't know how to The POST data outputs the following: 2011-9-23 Assuming I have defined $date as the posted data from the previous form, how do I write some code to tell it to output it as September 23, 2011, or just Sept 2011?
  5. Thank you, that did it! Sorry, a bit of a novice, how would I change that?
  6. Here is a screengrab of the form. In this example, there are four rows being updated at once, but it does it no matter how many I'm updating. As before, this form worked fine when the textarea was a locked field and wasn't part of the update. [attachment deleted by admin]
  7. The 'steelwork including cold rolled members and flooring support' bit comes from one of the textarea entries. The specific textbox entry its referring to reads "Structural steelwork including cold rolled members and flooring support beams".
  8. Does anyone have a recommendation for a very straight forward method of sending a page generated using php and mysql (information displayed on page is taken from the sql db) to a PDF file? The page layout includes no CSS, just html tables, b, u and img tags.
  9. Here's my whole form, if its of any consequence, but it worked fine before I added the textarea. echo" <form action=\"contract.php?action=amend_mworks&con=$_GET[con]\" name=\"frmEdit\" method=\"post\"> <br><b>List of Measured Works</b><br><br> <table width=\"705\"> <tr> <td width=\"30\" bgcolor=\"#E8EBF0\" style=\"border:solid 1px #ccc\"> <b>Item</b></td> <td bgcolor=\"#E8EBF0\" style=\"border:solid 1px #ccc\"><b>Description</b></td> <td width=\"80\" bgcolor=\"#E8EBF0\" style=\"border:solid 1px #ccc\" align=\"center\"> <b>Qty</b></td> <td width=\"40\" bgcolor=\"#E8EBF0\" style=\"border:solid 1px #ccc\" align=\"center\"> <b>Unit</b></td> <td width=\"50\" bgcolor=\"#E8EBF0\" style=\"border:solid 1px #ccc\" align=\"center\"><b>Rate</b></td> <td width=\"50\" bgcolor=\"#E8EBF0\" style=\"border:solid 1px #ccc\" align=\"center\"><b>Ext</b></td> <td width=\"50\" bgcolor=\"#E8EBF0\" style=\"border:solid 1px #ccc\" align=\"center\"><b>Claimed<br>(%)</b></td> <td width=\"50\" bgcolor=\"#E8EBF0\" style=\"border:solid 1px #ccc\" align=\"center\"><b>Claimed<br>To Date</b></td> </tr> "; // Display basic row of info for measured works (i.e. item, qty etc) $get_mworks = mysql_query(" SELECT mworks_id as mid, mworks_item as item, mworks_detail as detail, mworks_qty as qty, mworks_unit as unit, mworks_percent as percent, mworks_qty * mworks_rate as ext, (mworks_percent / 100) * (mworks_rate * mworks_qty) as ctd, mworks_rate as rate FROM val_mworks WHERE mworks_con = '".$_GET["con"]."' ORDER by mworks_id ASC ",$objConnect); while($data = mysql_fetch_array($get_mworks)) { echo" <tr> <td valign=\"middle\">$data[item]</td> <td valign=\"middle\"><textarea id=\"detail[]\" name=\"detail[]\" rows=\"7\" cols=\"35\" wrap=\"hard\">$data[detail]</textarea></td> <td align=\"center\" valign=\"middle\"><input type=\"text\" style=\"background-color: transparent; border-style: solid; border-width: 0px 0px 1px 0px; border-color: #001947\" name=\"qty[]\" size=\"7\" value=\"$data[qty]\" id=\"qty\"></td> <td align=\"center\" valign=\"middle\">$data[unit]</td> <td align=\"center\" valign=\"middle\">"; $rate = number_format($data['rate'],2); // Calculate and display measured works ext, and percentage and amount already claimed echo" &#163;$rate</td> <td valign=\"middle\" align=\"center\">"; $ext = number_format($data['ext'],2); echo"&#163;$ext</td> <td align=\"center\" valign=\"middle\"><input type=\"text\" style=\"background-color: transparent; border-style: solid; border-width: 0px 0px 1px 0px; border-color: #001947\" name=\"percent[]\" size=\"5\" value=\"$data[percent]\" id=\"percent\"></td> <td align=\"center\" valign=\"middle\"><input type=\"hidden\" name=\"mid[]\" value=\"$data[mid]\" id=\"mid\">"; $ctd = number_format($data['ctd'],2); echo"&#163;$ctd</td> </tr>"; } echo" </table> <br> <input type=\"submit\" name=\"submit\" value=\"Save Changes to Measured Works\"></form>";
  10. I used to have a straight forward piece of code that updated multiple rows of info using a foreach loop. However, ever since I've introduced a textarea box into the mix, it's been throwing up syntax errors. Here's my textarea box: <textarea id=\"detail[]\" name=\"detail[]\" rows=\"7\" cols=\"35\" wrap=\"hard\">$data[detail]</textarea> And here's my UPDATE query: foreach($_POST['mid'] as $key=>$val) { mysql_query("UPDATE val_mworks SET mworks_percent = ".$_POST['percent'][$key].", mworks_detail = ".$_POST['detail'][$key].", mworks_qty = ".$_POST['qty'][$key]." WHERE mworks_id = $val ") or die(mysql_error()); } Can anyone see anything obvious that I'm doing wrong?
  11. There must be something seriously fundamentally wrong with what I'm doing. I can't even get an individual field to display. It displays the text saying "Client:" but not the client name I'm looking for. FYI - the url ends with edit.php?action=contract&con=1 <?php include("conn.php"); ?> <?php $action = $_GET["action"]; // Amend a contract if($action == "contract") { echo"Client:"; $get_client = mysql_query(" SELECT C.client_name as clientname FROM val_clients C, val_contracts T WHERE T.contract_id = '".$_GET["con"]."' AND C.client_id = T.contracts_client ",$objConnect); while($data = mysql_fetch_array($get_client)) { echo"$data[clientname]"; } } else { echo""; } ?> Someone put me out of my misery!`
×
×
  • 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.