-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
mssql was superseded with sqlsrv, check the msdn forums for the use of sqlsrv syntax in PHP 5.3+
-
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
ok, I'm getting really confused here. It's working? If the message isn't showing, nothing was changed (this will happen if the information in the UPDATE is the same as the infomation already in the database -from php.net : When using UPDATE, MySQL will not update columns where the new value is the same as the old value. This creates the possibility that mysql_affected_rows() may not actually equal the number of rows matched, only the number of rows that were literally affected by the query.) You could put an else{} in for the if(mysql_affected_rows() === 1) that displays something to that effect. There is no reason that the or die() would have any effect on the outcome of the query. -
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
Adam, that's my fault, I'm getting mixed up with the other page code Blep add the ."<br>-----------------------<br>$insert_query" to the line that is providing your mysql_error() output on the page that Adam is talking about, not the other one -
Access (because it's s**t) uses square brackets instead of backticks. Best fix would be to use a real database backend and use your Access disk as a skeet.
-
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
yeah your still doing an UPDATE, I want you to change the or die () (just the bit in the brackets, not the whole line) on the mysql_query() line to the following : mysql_query($insert_query) or die (mysql_error()."<br>-----------------------<br>$insert_query"); Then post up what the return is. -
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
yeah, you will need to do this: <input type="hidden" id="review_id" name="review_id" value="<?php echo $id; ?>" /> -
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
what you need to do is add a new input element to your HTML form that looks like <input type="hidden" id="revire_id" name="review_id" value="$id" /> Then somewhere on the page with the insert add the code $id=$post['review_id']; between assigning $post to $_POST and building your query. -
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
ok, the form code: <form action = "saveMom.php" method = "post"> <tr> <th><h2>MOM</h2></th> <th><input type = "text" name = "booking_number" size = "16" value = "" readonly = "readonly"/></th> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <th><u>Quality Ranking of Review</u></th> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Quality ranking of Review (1-5)</td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>(To be completed by TC chairperson)</td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>1 = Undefined</td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>2 = Document not of sufficient quality to review, missing chapters, clear competence or schedule issue apparent in the review.</td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>3 = Insufficient participants in the review or insufficient preparation from participants.</td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>4 = Proper review with some major open issues but in control.</td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>5 = Proper review with no major open issues.</td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td><input type = "text" name = "quality_ranking_review" size = "1"/></td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <th><u>Quality ranking of input document (1-10):</u></th> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td><size = "2"><b>Criteria: Score - 1 = Yes or 0 = No</b></td> <td><input type = "text" name = "input_doc_rank" size = "1"/></td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td><size = "2"><b>___________________________</b></td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>To be completed by TC chairperson using TCOSSRC document checklist</td> </tr> <!-- -------------------------------------------------------------------------------- --> <!-- SET THIS TO BOOL IN DATABASE --> <tr> <td>Has the correct document instruction/template been followed?</td> <td><input type = "text" name = "correct_doc" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Has the document been internally reviewed?</td> <td><input type = "text" name = "internally_reviewed" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Does the requirements chapter state whether all requirements have been covered, and explain why specific requirements<br /> are not covered?</td> <td><input type = "text" name = "reqs_covered" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Is the document stored in the correct storage library with the correct status?</td> <td><input type = "text" name = "correct_storage_library" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Have all trouble reports for faults corrected by the system modifications been described? It should be obvious which<br /> applications were investigated to find all relevant trouble reports</td> <td><input type = "text" name = "reports_described" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Have all approved change requests been included?</td> <td><input type = "text" name = "approved_change_requests_included" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Are all open issues addressed?</td> <td><input type = "text" name = "issues_addressed" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Has the document been available at least 5 working days before the review date?</td> <td><input type = "text" name = "doc_available" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Does the Technical Solution chapter describe the solution to the problems described in the Statement of Problem chapter?</td> <td><input type = "text" name = "statement_problem_chapter" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Are there more than 50% major comments? <b>Yes = 0 No = 1</b></td> <td><input type = "text" name = "major_comments" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <th><u>Review Summary<u></th> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Result</td> <td><select name = "result"> <option value = '' SELECTED>-Please Select-</option> <option value = "Approved">Approved</option> <option value = "Not Approved">Not Approved</option> <option value = "Cancelled">Cancelled</option> </select> </td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>No. of Major Comments</td> <td><input type = "text" name = "num_of_major_comments" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>No. of Minor Comments</td> <td><input type = "text" name = "minor_comments" size = "1"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Next Review Forum</td> <td><select name = "next_review_forum"> <option value = '' SELECTED>-Please Select-</option> <option value = "N/A">N/A</option> <option value = "Re Review Full">Re-Review Full</option> <option value = "Re Review Simplified">Re-Review Simplified</option> </select> </td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <th><u>Particulars of Meeting</u></th> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Date</td> <td><input type = "text" name = "date" size = "4"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Time</td> <td><select name = "time"> <option value = '' SELECTED>-Please Select a Time-</option> <option value = "0800">08:00</option> <option value = "0900">09:00</option> <option value = "1000">10:00</option> <option value = "1100">11:00</option> <option value = "1200">12:00</option> <option value = "1300">13:00</option> <option value = "1400">14:00</option> <option value = "1500">15:00</option> <option value = "1600">16:00</option> <option value = "1700">17:00</option> <option value = "1800">18:00</option> <option value = "1900">19:00</option> </select> </td> </tr> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Venue</td> <td><select name = "venue"> <option value = '' SELECTED>-Please Select-</option> <option value = "Lough Mask">Lough Mask</option> <option value = "Lough Neagh">Lough Neagh</option> <option value = "Lough Sheelin">Lough Sheelin</option> <option value = "Lough Allen">Lough Allen</option> <option value = "Shaw">Shaw</option> <option value = "Beckett">Beckett</option> <option value = "Yeats">Yeats</option> <option value = "Heaney">Heaney</option> <option value = "Tyndall">Tyndall</option> <option value = "Lilliput">Lilliput</option> <option value = "Lough Ree">Lough Ree</option> <option value = "Goldsmith">Goldsmith</option> <option value = "Kelvin Meeting Room">Kelvin Meeting Room</option> <option value = "Blyry">Blyry</option> <option value = "Lough Conn">Lough Conn</option> <option value = "Lough Corrib">Lough Corrib</option> <option value = "Lough Derg">Lough Derg</option> <option value = "Lough Owell">Lough Owell</option> <option value = "OSS Demo Room">OSS Demo Room</option> <option value = "Synge Conference Room">Synge Conference Room</option> <option value = "Annexe Conference Room">Annexe Conference Room</option> <option value = "Lars Magnus">Lars Magnus</option> <option value - "Office">Office</option> </select> </td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <th><u>Actions<u></th> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Type</td> <td><select name = "type"> <option value = '' SELECTED>-Please Select-</option> <option value = "remark">Remark</option> <option value = "action">Action</option> </select> </td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Time</td> <td><select name = "time"> <option value = '' SELECTED>-Please Select a Time-</option> <option value = "0800">08:00</option> <option value = "0900">09:00</option> <option value = "1000">10:00</option> <option value = "1100">11:00</option> <option value = "1200">12:00</option> <option value = "1300">13:00</option> <option value = "1400">14:00</option> <option value = "1500">15:00</option> <option value = "1600">16:00</option> <option value = "1700">17:00</option> <option value = "1800">18:00</option> <option value = "1900">19:00</option> </select> </td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Location</td> <td><input type = "text" name = "location" size = "10"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Severity</td> <td><input type = "text" name = "severity" size = "10"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Resp</td> <td><input type = "text" name = "resp" size = "10"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Status</td> <td><input type = "text" name = "Status" size = "10"/> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Comment</td> <td><textarea name = "comment" cols = 40 rows = 6/></textarea></td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Remark</td> <td><select name = "remark"> <option value = '' SELECTED>-Please Select-</option> <option value = "Remark">Remark Acted</option> <option value = "Action">Remark Not ccepted</option> </select> </td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td>Miscellaneous</td> <td><textarea name = "miscellaneous" cols = 40 rows = 6/></textarea></td> </tr> <!-- -------------------------------------------------------------------------------- --> <tr> <td> <input type="button" name="reset_form" value="Clear Fields" onclick="this.form.reset();"> <input type="submit" name="save" value="Save MOM" /> </td> </tr> <!-- -------------------------------------------------------------------------------- --> </table> </form> and the DB lookup from that page: if (isset($post['searchID']) && $post['searchbyequipmenttype'] != '') { $id = $post['searchbyequipmenttype']; $sql = <<<SQL SELECT * FROM tc_tool.forms WHERE ( review_id = $id ) SQL; $data = mysql_query($sql) or die(mysql_error()."<br>-----------<br>$sql"); $num = mysql_num_rows($data); // <-- This line is counting the number of rows returned by the query //===================================================== // Prints out details related to ID entered //===================================================== if($num != 0) { while($row = mysql_fetch_assoc($data)) { echo "<table id = \"reviewid\"> <tr> <th>Review Forum</th> <th>Review ID</th> <th>Document Title</th> <th>Document Number</th> <th>Document Type</th> <th>Project Name</th> <th>Author Name</th> <th>Chairperson</th> </tr>"; echo "<td>".custOut($row['review_forum']) . "</td>" . "<td>".custOut($row['review_id']) . "</td>" . "<td>".custOut($row['doc_title']) . "</td>" . "<td>".custOut($row['doc_number']) . "</td>" . "<td>".custOut($row['doc_type']) . "</td>" . "<td>".custOut($row['proj_name']) . "</td>" . "<td>".custOut($row['author_name']) . "</td>" . "<td>".custOut($row['chairperson']) . "</td>" ; echo "</table>"; While we get to looking through this I seen that the page you PM'd me that I lifted this from has a whole lot of short open tags on it (where you have used <? instead of <?php) You need to change these to use the full <?php open tags -
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
Just the bit for the form, don't need the whole page, and if you PM me it, ill just post it in here anyway, that way everyone else can see it too and offer their help (many hands and all that ) Um, not it's not. Yeah, yeah, we coverd that yesterday thorp sheesh, I make a "Simple" mistake and everyones all over me :'( I'm going for therapy now -
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
let's see your HTML for the form as wellplease Blep -
You can use javascript to create masks for form fields. PHP manual page for preg_match should get you going with the use of RegEx. Something else that you may want a look at since your focusing on if conditionals at the moment is the switch section of the manual. To cheack a charactor you can use the preg_match or use a combination of substr and chr
-
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
Ok Blep, let's see the up to date code and a description of what's going on. Is $_POST['review_id'] actually the ID from the database that defines the record? and is it actualy in the form that is submitted? -
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
do we know that there are values getting populated into the $post array? try a var_dump($post) just before the query -
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
Okay, your sanisize is redundant the way you have the code just now. you are taking the post array and running your sanatise_data() function directly against it, that's not going to work as it's not the array that needs sanitized but rather the values in it. As such you need to loop through the $_POST array and sanitize each value individualy. Also, you are saying that the variable $post is = to the sanitized $_POST, and then using the raw $_POST in the update, rather than the $post sanitized version. change $post = sanitize_data($_POST); to $post = array(); foreach($_POST as $key =>$value){ $post[$key] = sanitize_data($value); } Then change your query to use the $post array rahter than the $_POST array. As for the id variable, how do you plan to tell the query which id field in the database its supposed to be updating? -
can we see the code you are using to call the prodisused method?
-
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
I coppied too many commas at the end of the lines, make sure there is only 1 at each line. You will need to have a php variable that contains the id of the record you are trying to update, before you can perform the update, you should be pulling it from the previous pages lookup either as a session variable or as a post varialbe from a hidden field. I was talking about sanitising all the inputs that you are using in the UPDATE in this code. Unless you are modifying the contents of the $_POST array directly you are updating the database with raw, unchecked user input. -
post up your MySQLDB class (using the ) so we can get a look at it
-
you're not calling your or die properly, it should be : or die (mysql_error()); see those other brackets?
-
Problem with storing info & associated ID
Muddy_Funster replied to blepblep's topic in PHP Coding Help
you're over complicating it (the S in SQL is for Simple ) : <?php if(isset($_POST['insert2'])) { $insert_query = "UPDATE tc_tool.forms SET booking_number = '{$_POST['booking_number']}',, quality_ranking_review = '{$_POST[quality_ranking_review]}',, ... remark = '{$_POST['remark']}',, miscellaneous = '{$_POST['miscellaneous']}' WHERE (id = $id)"; ?> I assume you are storing the relevent id in some variable or other, for this example I have used $id, you should change this to your relevent id varaible. Remember to use curly braces {} arround array keys when puting them in strings and to use single quotes around array key names (inside the square brackets []). On another note, you really shouldn't be sending raw form data to usour database, you should always check and sanatise it before hand. -
Fatal error: [] operator not supported for strings in
Muddy_Funster replied to frankpetrov's topic in PHP Coding Help
I usualy use die(var_dump($variable)); at strategic points to debug code. var_dump is better for debuging as it gives you the variable type as well as the contnent. -
Fatal error: [] operator not supported for strings in
Muddy_Funster replied to frankpetrov's topic in PHP Coding Help
if $monsters is not already declared as a string try taking the space out from between the [ ] when you are assigning the value to it. -
take out the first if. That's not how you nest if's and it's completly redundant.
-
yip, echo on both.
-
you also need to add an = sign to the last echo in this bit of code (compare with your last post of this code), and check the maxPrice one aswell <select name="min price" width="80px"> <?php $priceLimit = 350; for($minPrice = 40; $minPrice <= $priceLimit; $minPrice =( $minPrice+ 10)){ if ($minPrice == 40){ echo"<option value=\"0\" selected=\"selected\">No Min</option>"; } else{ echo "<option value=\"$minPrice000\">£$minPrice,000</option>"; }
-
<div id="table2"> <table id="NBtable"> <tbody><tr> <td><p class="NBS">Number of bedrooms:</p></td> <<<<<<<--------here <td><div id="NB">