Jump to content

Search the Community

Showing results for tags 'add'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 3 results

  1. Hi, I am trying to add values together in my while loop, so far I have: $q->query($DB, $SQL); while($avrating=$q->getrow()): $averageratings = $avrating['sum(rating)'] / $noofreviews; $overallaverage = round($averageratings, 2) + round($averageratings, 2); echo '<p>'.$avrating['rating_name'].': '.round($averageratings, 2).'</p>'; endwhile; echo 'x'.$overallaverage; $overallaverage += $overallaverage / 10; echo 'The Average: '.$overallaverage; from this, I get: x7.34The Average: 8.074 the total shold be: 42.34 then dived by 10 should be 4.23
  2. hi, i am not gud in ajax. i have this code... <html> <head> <title>Sum Html Textbox Values using jQuery/JavaScript</title> <style> body { font-family: sans-serif; } #summation { font-size: 18px; font-weight: bold; color:#174C68; } .txt { background-color: #FEFFB0; font-weight: bold; text-align: right; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> </head> <body> <table width="300px" border="1" style="border-collapse:collapse;background-color:#E8DCFF"> <tr> <td width="40px">1</td> <td>Butter</td> <td><input class="txt" type="text" name="txt"/></td> </tr> <tr> <td>2</td> <td>Cheese</td> <td><input class="txt" type="text" name="txt"/></td> </tr> <tr> <td>3</td> <td>Eggs</td> <td><input class="txt" type="text" name="txt"/></td> </tr> <tr> <td>4</td> <td>Milk</td> <td><input class="txt" type="text" name="txt"/></td> </tr> <tr> <td>5</td> <td>Bread</td> <td><input class="txt" type="text" name="txt"/></td> </tr> <tr> <td>6</td> <td>Soap</td> <td><input class="txt" type="text" name="txt"/></td> </tr> <tr id="summation"> <td> </td> <td align="right">Sum :</td> <td align="center"><span id="sum">0</span></td> </tr> </table> <script> $(document).ready(function(){ //iterate through each textboxes and add keyup //handler to trigger sum event $(".txt").each(function() { $(this).keyup(function(){ calculateSum(); }); }); }); function calculateSum() { var sum = 0; //iterate through each textboxes and add the values $(".txt").each(function() { //add only if the value is number if(!isNaN(this.value) && this.value.length!=0) { sum += parseFloat(this.value); } }); //.toFixed() method will roundoff the final sum to 2 decimal places $("#sum").html(sum.toFixed(2)); } </script> </body> </html> ..........................from net. this will add all the input fields and give us the total of it. but i want one more input field in which when i put some value . then, total amount should be subtracted from it and gives the result.. can anyone give me some suggestions.... please ????? thanks.
  3. i'm trying to add data into specific user in database. the one who login in the form is admin and the admin will add information to the user's database.. here's the php code <?php session_start(); if ($_SESSION['UserId'] == "") { echo "Please Login first"; } else { echo "<h1> Appliances's adding list</h1>"; echo "<table>"; echo "<form action ='addappliancesprocess.php' method = 'POST'>"; echo "<tr> <td>Appliances Name: <input type='text' name='appliancesname'></td> </tr>"; echo "<tr> <td>Port Number: <select name = 'port' value='port'> <option value 'RB0'>RB0</option> <option value 'RB1'>RB1</option> <option value 'RB2'>RB2</option> <option value 'RB3'>RB3</option> <option value 'RB4'>RB4</option> <option value 'RB5'>RB5</option> <option value 'RB6'>RB6</option> <option value 'RB7'>RB7</option> </select> </tr>"; echo "<tr> <td>Insert characters on: <input type='text' name='charon'></td> </tr>"; echo "<tr> <td>Insert characters off: <input type='text' name='charoff'></td> </tr>"; echo "<tr> <td colspan=2 align= 'right'><br> <INPUT Type='button' VALUE='Back' onClick='history.go(- 1);return true;'> <input type='submit' name='update' value='Submit'> </td> </tr>"; echo "</table>"; } ?> and here is the process <?php session_start(); $appliancesname=$_POST['appliancesname']; $port=$_POST['port']; $username=$_REQUEST['username']; $charon=$_POST['charon']; $charoff=$_POST['charoff']; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("myfyp", $con); ?> <?php $query="SELECT from user where UserId = '".$_SESSION ['UserId']."'"; //if ($username != UserId) { //echo "no user"; //}else{ $sql="INSERT INTO appliances VALUES ('','$appliancesname','$port','$username','','$charon','$charoff')"; echo $query; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "You have choose the following:<br>"; echo "<br>Appliances: $appliancesname</br>"; echo "<br>Port Number: $port</br>"; echo "<br>Character on: $charon</br>"; echo "<br>Character off: $charoff</br>"; echo "<br><INPUT Type='button' VALUE='Back' onClick='history.go(- 1);return true;'>"; //} ?> when i try to add it will add to the database but the port is not updated and the userid is empty.. i'm sorry.. i am new to php.. there are lots that i don't know..
×
×
  • 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.