Jump to content

dvd420

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Everything posted by dvd420

  1. Well current view is precisely to make different table for different device. That is surely better then storing the data under the single table. Second is to apply partition to database. But I am looking for more specific and more tricky solution. More inputs are most welcome.
  2. Hi, I am making application for vehicle tracking system using GPS. There I am supposed to receive data every minute from a device. Technically - I will be getting 5 records every minute per device. i.e 5 * 60 * 24 records/day = 7200 records/day for single device. I am suppose to store that data for 2 months i.e 7200 * 30 * 2 = 4,32,000 records for a single device. If number of devices are 100 then storing all the records (43200000 records) in single table wont be a feasible option, as i need to fetch records from the table for report generation. Can any one help to come over the above mentioned problem? Thanks, Rahul
  3. Hi Shawn, Welcome :-) Definitely, we will be benefited of ur experience.
  4. Hi, Wenever you are executing the query to insert data into table, call your mailer script. To send notification after 2 days, schedule a cron job
  5. Where & how u r defining the PATH for this?
  6. Hi, The mail() function is PHP just triggers the mail, it never bothers about its delivery. If you are interested in writing few extra lines of PHP, use PHPMailer class.
  7. Hi you should use else if ($_GET['function'] == "1" || $_GET['function'] == "2" || $_GET['function'] == "3")
  8. Hi if I m getting this correctly, u just need to execute the query: UPDATE <table_name> SET qid = qid + 1 WHERE qid > 3
  9. Hi, I think, create an array containing page id's and corresponding includes. $inc_list = array(1 => "include1.php", 3 => "hello.php", 11 => "welcome.php"); if( file_exists($inc_list[ $_GET['PageID'] ]) ) include( $inc_list[ $_GET['PageID'] ]); else include("default.php");
  10. Hi, the prob is in HTML styling. To get colored options the method is something like: <select> <option style="color:red">Item1</option> <option style="color:green">Item2</option> </select> so now u should use: if($month[$i] == $g_month) { echo "<option value='$i' style=\"color:red\">"; } else { echo "<option value='$i' style=\"color:any_color\">"; } echo "$month[$i] </option>";
  11. if($month[$i]==$i) Should it work?? Comparing string with integer, it'll always return false. The following can be a valid one: if($month[$i] == $g_month)
  12. use following, if you want to unset the values: $array = array(1 => "Audi", 2 => "Ferrari", 3 => "Fiat"); $keys = array_keys($array); array_fill_keys($keys, NULL);
  13. Hi, When I was using this approach to mail, I did two things to overcome the SPAM issue... make the pause interval variable . $count = ($count + 1) % 10; sleep( $count * $interval); . and the second thing was, to change the "From" address, message body & Subject line along with the sleep interval. We can just add some dot(.)s or any char at the end of these strings.
  14. Hi, First of all time() function returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). It does not take any input argument. Even if you supply, it'll return the current time. It seems you are using a 3D array $bookings, which holds the time. Anyways, it doesn't matter. Instead of using time() use date(). The prototype of date() is: string date ( string $format [, int $timestamp ] ) The timestamp is optional, its the int value which will be converted into date/time according to the format $format. And regarding your 3rd example: plz check the date format in array.
  15. Hi, Don't you think scanning the db for each record will increase the overhead. Rather you should query the db only once, then use a loop through the result set array for sending out the mail. like, if you are using mySQL then: . . . $query = "SELECT firstname, lastname, address FROM mailing_list;"; //execute the query once, $result is an array $result = mysql_query($query, $link); //Loop for the results while ($row = mysql_fetch_assoc($result)) { // Prepare the message here $msg = "Dear ".$row['firstname'] . $row['lastname']; $msg. = "More stuff here"; mail($row['address'], 'My Subject', $msg); }
  16. If you are using some other database, you have to look for the corresponding functions. I have never worked with SQL Server. If you are using Oracle databse with OCI then it'll look like: $conn = oci_connect("username","password","host_string"); $query = "SELECT firstname, lastname, address, age FROM friends"; //Prepare the qry to be executed $stid = oci_parse($conn, $query); $rerult = oci_execute($stid, OCI_DEFAULT); // Execs the stmt while ($row = oci_fetch_assoc($stid)) { foreach ($row as $item) { echo "$item\t"; echo "\n"; } } foreach is yet another construct to access arrays. WHILE loop can also be used.
  17. Hi, So as far as I can get the issue, each day is having different records, so anyhow you have to query the database for each day. However, you can write the query without any day constrain and you can fetch all the records fro all the days in single query. The result will be an array. Run a while loop for this array. Hope the following stuff can help you //Connect to db server $link = mysql_connect('SERVER', 'USER', 'PASSWORD'); //Select the db $db_selected = mysql_select_db('DB_NAME', $link); //This is the query $query = "SELECT firstname, lastname, address, age FROM friends;"; //execute the query once, $result is an array $result = mysql_query($query, $link); //Loop for the results while ($row = mysql_fetch_assoc($result)) { echo $row['firstname']; echo $row['lastname']; echo $row['address']; echo $row['age']; } mysql_free_result($result);
  18. Hi, You can manupulate the strings (notes) in PHP easily. Bind vars can also be used.
  19. Hi, I am unable to get a clear picture of the problem, but I think you should implement the logic in SQL rather than PHP. Some better answers can be given if some more details are available.
  20. Hi Russel, Thanks, This explains everything. But I just want to know is there a way to prevent this behaviour?? I tried using SESSION & Write to file. But no luck.
  21. Hi All, This is regarding oci. When the script ends, PHP ROLLBACKs all the transactions, if we are not passing OCI_COMMIT_ON_SUCCESS while calling oci_execute(). My problem is, I don't need this ROLLBACK after the script ends. I want to do COMMIT/ROLLBACK myself. So is there any way to do so.
  22. Hi, Is it possible to access/modify a variable from another session in PHP.
  23. I think oci_field_is_null() is used for a perticular value.
  24. Hi, I want to describe a table. oci_execute() is not taking "DESC[RIBE]" as a valid query. So, I am using the following code for it: But I am unable to detremine if a field is NULL or NOT NULL. oci_field_is_null() is returning FALSE always. function desc_table($conn, $tab) { $stid = oci_parse($conn, "SELECT * FROM $tab"); $r = oci_execute($stid, OCI_DEFAULT); if (!$r) { $e = oci_error($stid); print $e['message']; } else { $ncols = oci_num_fields($stid); for ($i = 1; $i <= $ncols; $i++) { $column_name = oci_field_name($stid, $i); $column_type = oci_field_type($stid, $i); $column_size = oci_field_size($stid, $i); $column_nvl = oci_field_is_null($stid, $i); // Print .... } } }
×
×
  • 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.