Jump to content

Search the Community

Showing results for tags 'data'.

  • 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 7 results

  1. Hello. I have a page that displays data from a database based on pagination. All works well if I display all records (19 at the moment), but if I choose to view 8, or 10, or less than 19, I see duplicates of the same data, as well as new data not showing. How can I prevent duplications and have new date viewed without having to view all data? include("headsection.php"); include("nav.php"); if(isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $num_per_page = 20; $start_from = ($page -1) * 2; $sql = "SELECT * FROM people ORDER BY id ASC LIMIT $start_from, $num_per_page"; $result = $con->query($sql); if( $result->num_rows > 0) { ?> <h1 class="center">List of all Users</h1> <table class="container3"> <tr> <td width="auto">PID</td> <td width="auto">Name</td> <td width="auto">Relationship</td> <td width="auto" class="center" colspan="3">Actions</td> </tr> <form action="" method="POST"> <?php while( $row = $result->fetch_assoc()){ echo "<input type='hidden' value='". $row['id']."' name='id'>"; //added echo "<tr>"; echo "<td class='success'>".$row['pid'] . "</td>"; echo "<td class='success'>".$row['name'] . "</td>"; echo "<td class='success'>".$row['relationship'] . "</td>"; echo "<td><a href='view.php?id=".$row['id']."' class='primary' title='view'>V</a></td>"; echo "<td><a href='edit.php?id=".$row['id']."' class='warning' title='edit'>E</a></td>"; echo "<td><a href='delete.php?id=".$row['id']."' class='danger' title='delete'>D</a></td>"; echo "</tr>"; } ?> </form> </table> <?php $pr_query = "SELECT * FROM people ORDER BY id"; $pr_result = $con->query($pr_query); $total_record = mysqli_num_rows($pr_result); //echo $total_record; $total_page = ceil($total_record/$num_per_page); echo "<h3 class='center'>Number of records in database: " . $total_record . "</h3>"; echo "<p class='center'>"; if ($page > 1 ){ echo "<a class='primary' href='users.php?page=".($page-1)."'>Previous</a>"; } for($i=1; $i<$total_page; $i++) { echo "<a class='primary' href='users.php?page=".$i."'>$i</a>"; } if ($i > $page ){ echo "<a class='primary' href='users.php?page=".($page+1)."'>Next</a>"; } echo "</p>"; ?> <br><br> <?php } else { echo "<br><br>No Record Found"; } ?> <?php include("footsection.php"); ?> As the site is localhosted, i am using mysqli - the site will not be online. Thanks in advance for any help.
  2. Hello. I am using a form to send data to my database but when I submit the form, the data is not shown on the database. I am connected to the database so I don't think the problem lies there. Also, I have a redirect option via 'Location:' which also works. I am following online examples for the php. This is the PHP I am using: <?php include("dbcon/database-conn.php"); if (!empty($_POST)) #($_SERVER["REQUEST_METHOD"] == "POST") { $pagelinks = $_POST['pagelinks']; $title = $_POST['title']; $asideleft = $_POST['asideleft']; $body = $_POST['body']; $asideright = $_POST['asideright']; $sourceref = $_POST['sourceref']; $sourceimg = $_POST['sourceimg']; $q = "INSERT INTO pages (pagelinks) VALUES ('$_POST[pagelinks]')"; if ($_POST["add_record"]){ header('location:index.php'); exit(); } } ?> The form 'name' values match. As you can see I have tried two methods of 'Post' but neither seem to work. I would like to point out that this is an offline, local test and that I am aware that I am not using real_escape_strings, but I will, once I get the code to work. Also, I am aware of PDO, which I have tried but it is too complex, for me to solve right now. I am familiar with mysqli (including OOP), but am still learning.. I would be grateful if you can help solve my current issue. Thanks in advance for any help.
  3. I have an html form that inserts a record into database. I also have a an html edit form that retrieves the data from the database. Normally everything works. But I just noticed that I have an issue if I use double quotes in the form field. It'll insert into the database fine. The problem arises when outputting the variable in the form field. If I echo it outside the form field, it'll show up fine with the double quotes. But inside the field, I only geta partial string. For eg. $variable_input = '5 3/4" Glitter Concealed Platform Pump'; The above will insert to the database. But if I retrieve it in the form field below, it'll return with one number only. <input type="text" name="title" value="5" /> Is there a way to fix the variable output of the wording that includes the double quotes?
  4. Hi, I have a PHP script using the cURL function. This script send the data by a web service. It works often without problem. Sometimes, he sent a double data : same data by two times. I checked the log file this script (by curl_getinfo) on "total_time" When this script works correctly (it send the data only one time) : the total_time is less than 6 second. but when the total_time is more than 7 second, (this is a casual/occasional situation), my script send same data by two times so it is double data! So the web service send the ACK(Acknowledgment) which takes a long time (more than 7 second) and then, the TCP send again same data to a web service. How can I avoid this doubling ? By increasing this time waiting / time limit ? How can I define this time limit for 12 second? Could you help me : Thanks
  5. I'm writing a PHP-based API around some data that is updated as frequently as once a minute, or as infrequently as once every 15 minutes. I'd like to have a cron job push alerts to end users when certain criteria is met (e.g. data goes above a certain threshold), but because my data changes so rapidly and is prone to wild fluctuations, I'm not entirely sure how to approach this. For reference, users can include, for example, people who have downloaded my Pebble smartwatch app, or my upcoming mobile phone app. The data that I'm most interested in (which, if you're interested, is from the ACE spacecraft, and is used to help people view the northern or southern lights) changes every fifteen minutes, and the Kp index it provides is used as a (arguably) good indicator of how likely you are to see an aurora. Values under 5 are usually of no interest to most, anything above 5 (up to 9) are worth getting an alert about. These values can fluctuate, so if a Kp 5 storm is expected, it can hit 6, then dip to 4, then back to 5 and so forth. This is due to the particles ejected from the sun not being a nice, even "wave". I've personally witnessed nights where Kp goes up, then sits low for a while, so you head home, only to find that 10 minutes later it picked up again. Aaanyway, back to my story, I'd like to find a way to alert users about these values when they're of interest, but without bombarding them with notifications, or missing too many events. Here's the various options I've considered: Send an alert every 15 minutes (too often, too annoying, not 'smart') Send an alert every 15 minutes, but only if the value has increased, then "reset" the check after a period of time (better, but what if it hits 7, then dips to 4 for 45 minutes, then hits 6.99? You'd miss out on an alert!) Find a way to check if the user has dismissed the notification and don't re-send it to them for an hour (not feasible, as Pebble's UX doesn't really allow for that, not to mention iOS doesn't have a way to notify your app when an alert has been dismissed) Some kind of data check, where if a value has remained high for longer than 30 minutes, it's alert-worthy and one gets sent out (but you'd miss out on stuff if the value is high for 29 minutes)And riding on the back of that, if the value remains stable, prime the alert. If it increases after it's primed, send the message. I'm more than happy to do some reading and learning. I just didn't exactly know what to search for, as I'm not dealing with something like storage space (where you can send an email if it hits < 20%, and it's unlikely that the storage will fluctuate between 20% and 21%, causing repeated messages) or rare events like CPU usage that you can alert if it stays high for longer than x many minutes
  6. The code in attached file is not working for me. and i am failed to find any mistake. Anyone help me please. deletedept.php
  7. Hi, I have a json data, below which contains an item with tax: "date": "2015-05-05 12:41", "shop": "Toto", "products": [ { "price": "2.00", "quantity": "1", "description": "chocolat", "tax": [ { "price": "1.00", "quantity": "1", "description": "tax1" }, { "price": "2.00", "quantity": "1", "description": "tax2" } ] } ] } I am able to calculate the price ($amountAll) with the following code: $datajs = "myJsonSimple2.json"; $datajs = file_get_contents($datajs); $decodageDatajs = json_decode($datajs); $dateBiling = $decodageDatajs->date; $shopName = $decodageDatajs->shop; foreach ($decodageDatajs->products as $obj) { $ItemPrice = $obj->price; $ItemQuantity = $obj->quantity; $ItemDescription = $obj->description; $taxes = (array)$obj->tax; $taxesPrice1 = !empty($taxes[0]) ? $taxes[0]->price : 0.00; $taxesPrice2 = !empty($taxes[1]) ? $taxes[1]->price : 0.00; $taxesQuantity1 = !empty($taxes[0]) ? $taxes[0]->quantity : 0; $taxesQuantity2 = !empty($taxes[1]) ? $taxes[1]->quantity : 0; $taxesDescription1 = !empty($taxes[0]) ? $taxes[0]->description : '1er tax null'; $taxesDescription2 = !empty($taxes[1]) ? $taxes[1]->description : '2e tax null'; $amountAll = $ItemPrice * $ItemQuantity + $taxesPrice1 + $taxesPrice2; } But how I calculate if there are several items (2 or 3 or 5...) { "date": "2015-05-05 12:41", "shop": "Toto", "products": [ { "price": "2.00", "quantity": "1", "description": "chocolat", "tax": [ { "price": "1.00", "quantity": "1", "description": "tax1" }, { "price": "2.00", "quantity": "1", "description": "tax2" } ] }, { "price": "3.00", "quantity": "1", "description": "bonbon", "tax": [ { "price": "2.00", "quantity": "1", "description": "tax1" }, { "price": "3.00", "quantity": "1", "description": "tax2" } ] }, { "price": "2.00", "quantity": "1", "description": "gateaux", "tax": [ { "price": "1.00", "quantity": "1", "description": "tax1" }, { "price": "2.00", "quantity": "1", "description": "tax2" } ] } ] } I need like as : $amountAll = $ItemPrice1 * $ItemQuantity1 + $ItemPrice2 * $ItemQuantity2 + $ItemPrice3 * $ItemQuantity3 + $taxesPrice1a + $taxesPrice2a + $taxesPrice1b + $taxesPrice2b + $taxesPrice1c + $taxesPrice2c; but this is wrong : I must counter and use while statement but I don,t know how I can write ? $calculeItems = count($decodageDatajs->products); $i = 0; while ($i < $calculeItems) { foreach ($decodageDatajs->products as $obj) { $ItemPrice = $obj->price; $ItemQuantity = $obj->quantity; $ItemDescription = $obj->description; $taxes = (array)$obj->tax; $taxesPrice1 = !empty($taxes[0]) ? $taxes[0]->price : 0.00; $taxesPrice2 = !empty($taxes[1]) ? $taxes[1]->price : 0.00; $taxesQuantity1 = !empty($taxes[0]) ? $taxes[0]->quantity : 0; $taxesQuantity2 = !empty($taxes[1]) ? $taxes[1]->quantity : 0; $taxesDescription1 = !empty($taxes[0]) ? $taxes[0]->description : '1er tax null'; $taxesDescription2 = !empty($taxes[1]) ? $taxes[1]->description : '2e tax null'; $amountAll = $ItemPrice * $ItemQuantity + $taxesPrice1 + $taxesPrice2; /* this si wrong !!!!! $amountAll = $ItemPrice1 * $ItemQuantity1 + $ItemPrice2 * $ItemQuantity2 + $ItemPrice3 * $ItemQuantity3 + $taxesPrice1a + $taxesPrice2a + $taxesPrice1b + $taxesPrice2b + $taxesPrice1c + $taxesPrice2c; */ } $i++; } can you help me please Thanks
×
×
  • 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.