Jump to content

phpnewnoob

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpnewnoob's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey SergeiSS, You were right, I echoed it and that's a query error. I have rewrote the code and now it works, but there are still some issues with the date printout. I will give more details once I am back at home. I am going forward with your help! Thanks for your reply, I appreciate that much!
  2. Hi SergeiSS, Hmm, that's a good question! die(mysql_error()); reports that mysql_query near LIKE"" is not right, or something like that, I dont remember exactly, but I will check it out once I am at home and will post the HTML part as well (which I should've done with the firt post) so that you have a better idea. Thanks for th ereply! Appreciate that!
  3. Oh, sorry, will take into consideration. Thanks!
  4. Hi Everybody, I think it's fairly simple, but i am a noob in PHP so need help from advanced coders. I have MySQL table which is being filled up everyday, there are 7 fields in the table (submitter, choosebank, choosetype, ampaid, amret, date, descript). What I need is to create a search.php which will be looking up data in all fields and printing it on the screen and the search should be filtered. What I mean is when a user wants to search for data let's say using submitter who's name is Mitchel then it should search for all data and print all rows containing submitter (Mitchel) and the rest six fields. And if user searches let's say using submitter (Mitchel) and a certain date (let's say DEC-25-2011) then it should find all data containing Mitchel and DEC-25-2011 in the same row and print all rows which contain the same search parameter and the rest of the fields. Any help would be greatly appreciated! Here is the code I have so far, but it doesn't work. <code> <?php include ("blocks/db.php"); $sql = mysql_query("SELECT * FROM banks WHERE submitter LIKE '$sub' or choosebank LIKE '$bank' or choosetype LIKE '$type' or $money_column LIKE '$money_column' or $money_value LIKE '$money_amount' or inputdate LIKE '$inputdate' or descript LIKE '$descript'") or die(mysql_error()); echo "<table width='1000' border='1' cellspacing='0' cellpadding='1'>"; echo "<tr>"; echo "<td width='100'>Submitter</td>"; echo "<td width='90'>Bank</td>"; echo "<td width='110'>Type of Payment</td>"; echo "<td width='110'>Amount Paid</td>"; echo "<td width='110'>Amount Returned</td>"; echo "<td width='100'>Date</td>"; echo "<td width='366'>Description</td>"; echo "</tr>"; echo "</table>"; while ($row = mysql_fetch_array($sql)){ echo "<table width='1000' border='1' cellspacing='0' cellpadding='1'>"; echo "<tr>"; echo "<td width='100'>$row[submitter]</td>"; echo "<td width='90'>$row[choosebank]</td>"; echo "<td width='110'>$row[choosetype]</td>"; echo "<td width='110'>$row[ampaid]</td>"; echo "<td width='110'>$row[amret]</td>"; echo "<td width='100'>$row[date]</td>"; echo "<td width='366'>$row[descript]</td>"; echo "</tr>"; echo "</table>"; } ?> </code>
  5. Thanks a lot Sunfighter, you saved my day! Problem solved!
  6. Hey Sunfighter, you are awesome! You solved my problem! I have slightly adapted the code for my needs and it works exactly the way I wanted. Very much appreciate that! Thumbs Up to you man!
  7. Thanks a lot for the reply, I think I haven't explain myself clearly. I have a form with 3 dropdown lists (submitter, choosebank and choosetype), 1 textbox (where a user will be entering an amount) and 2 radio buttons (amount_paid and amount_returned) depending on which the entered amount is inserted into one of the fields of the database table. let's say user enters an amount into the textbox and selects amount paid radio button in this case the amount should go to amount paid field and amount returned filed is equal to "0". You already helped, but I did not explain it in details and would greatly appreciate your help again! Thanks!
  8. Hi, Noob needs help: need to assign the value of the textbox ("tbox") to the value of the radio button, can someone help me how to make it work? <code> <input name="tbox" type="text" class="field text medim" size="15"/><br> <input type="radio" name="ampaid" value="$tbox"/>Paid <br> <input type="radio" name="amret" value="$tbox"/>Returned </code> thanks.
  9. Here is the code so far: <? include ("blocks/db.php"); if (isset($_POST['firstname'])) {$firstname = $_POST['firstname']; if ($firstname == '') {unset($firstname);}} if (isset($_POST['lastname'])) {$lastname = $_POST['lastname']; if ($lastname == '') {unset($lastname);}} if (isset($_POST['age'])) {$age = $_POST['age']; if ($age == '') {unset($age);}} $myoption = $_POST['gender']; $sub = $_POST['submitter']; $bank = $_POST['choosebank']; ?> <? if (isset($firstname) && isset($lastname) && isset($age) && ($myoption) && ($sub) && ($bank)) { $result = mysql_query ("INSERT INTO banks (firstname,lastname,age,gender,submitter,choosebank) VALUES ('$firstname','$lastname','$age','$myoption','$sub','$bank')"); if ($result == 'true') {echo "<p>Data has been successfully added!</p>";} else {echo "<p>Error occured. Data hasn't been added!</p>";} } else { echo "<p>Some of the fields are not filled out. Please enter the required data.</p>"; } ?>
  10. Hey Everybody, I am new to PHP coding and have searched tons of forums and still looking... Please help me with the following: I have a MySQL database. There are several fields in the table, among them are Amount_paid and Amount_returned fields. And there are two radio buttons Amount paid and Amount returned and one textBox where I will be entering an amount. What I need is to assign an entered amount to one of those radio buttons (depending which one is selected) and insert the textBox value into the correct field (amount_paid or amount_returned) of the table. I have all other fields coded ok and they work, but have no idea how to make the above stuff work. The code is attached, please let me know if you need more info. Thanks a lot! EDIT: Sorry, now the file is attached 17217_.txt
×
×
  • 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.