
charles07
Members-
Posts
23 -
Joined
-
Last visited
Never
Everything posted by charles07
-
guys plz help, i have an array(52,51,52) here i want to insert first & last elements into DB, not second one does not follows the series another array (52,52,53) in this case insert first 2 elements into DB since last element does not follow the series. how is this possible?
-
thanks dcro2 i was looking cron job tutorial for the same cause, but couldn't find a good one. that link is helpfull. AyKay47, cd u plz explain a bit, a sample query would be highly helpful thanks in advance
-
yes AYKay47, it's in the time stamp format
-
guys, plz help i have table with datas like speed of vehicle, position e.t.c from morning 8 a.m. to 8 p.m. I need to get these details, but after every 15 minutes i.e. after selecting datas at 8 a.m. it shd select datas @ 8.15 a.m. then 8.30 a.m. hw can i write a mysql query for this ? or a PHP approach is appreciated
-
guys, please help i need balance amount of fees all students has to pay. Following is the DB structure. `feepayid` is primary key for paymentstable and paymentregister & `studentid` is primary in studentstable. I have written a query for this, please evaluate the query. paymentstable feepayidclassidpaydatepaymodefeeamountremarksfeediscount 3282012-03-06 19:32:351500hgfhf0 3182012-03-04 19:32:351800hgfhf0 3082012-02-06 19:32:3511200hgfhf0 2982012-02-06 19:32:3511100hgfhf0 paymentregister feepayidpayidtotalfeestudentid 32315002 31235002 30145004 29355004 studentstable studentidstudentname 2john 4mathew 5peter 6mary SELECT d.`studentid`, SUM(a.`totalfee` - (SELECT SUM(`feeamount`) FROM `paymentstable` WHERE a.`feepayid` = `feepayid`)) AS balancefee FROM `studentstable` d LEFT JOIN `paymentregister` a ON a.`studentid` = d.`studentid` GROUP BY d.`studentid`;
-
select multiple values from mysql between intervals
charles07 replied to charles07's topic in PHP Coding Help
u r right Psycho i am changing 'on', 'off' varchar fields to tinyint numeric 1 or 0. there is total 450000+ rows. thanks Psycho -
select multiple values from mysql between intervals
charles07 replied to charles07's topic in PHP Coding Help
thanks psycho & mikosiko I used mysql TIMEDIFF, it's working as intended. so my query is like "SELECT MIN(`time`) AS start_time, MAX(`time`) AS end_time,`remarks`, TIMEDIFF(MAX(`time`), MIN(`time`)) AS duration FROM `db_table` WHERE `time` BETWEEN '$predate' AND '$datenow' AND `device one` = 'OFF' AND `device two` = 'OFF' GROUP BY `remarks` ORDER BY `time` DESC" this gives the needed result, but is there any way to speed up the process, now it takes around 10 seconds to load the result -
select multiple values from mysql between intervals
charles07 replied to charles07's topic in PHP Coding Help
thank you Psycho that really helped, bu t still there is a hurdle. how do i get the duration of time i.e. difference between resulting two days 2011-12-03 22:06:42 and 2011-12-06 16:18:14 i am playing with mysql datedif & subtime functions, but no results yet. datediff gives resulting days and subtime gives need input as time no dates allowed before, and all these should work in less time -
hi all please help... i would like to get datas between certain intervals. please have a look @ db_table.jpg, it's the db structure. the red highlighted part is the value i need. condition is select values when both device one & device two are off. db_table_report.jpg is the resulting report format. It contains start time & end time and the duration.. please help, i know it's a bit complicated, but it's urgent.
-
How to echo the 'selected' value without using the submit button
charles07 replied to rick001's topic in PHP Coding Help
rick001 why do u want to use php here. just use simple javascript <label for="rank">Font</label> <select class="element select medium" id="fonts" onchange="findmyvalue()" name="fonts"> <option value="Arial" selected="selected">Arial</option> <option value="times" selected="selected">Times New Roman</option> </select> <script type="text/javascript"> function findmyvalue() { var myval = document.getElementById("fonts").value; alert(myval); } </script> -
i got one http://code.google.com/p/php-excel-reader/
-
hi all is there anyway embedding excel or .csv files to the webpage other than the folowing two options . saving it as a webpage . using google docs i used the following code, iam getting the .csv file in the page, but it would be good to have the color formatting, bold, italics... also in the webpage. is it possible? <?php $cnx = fopen("example.csv", "r"); //open example.csv echo("<table style='border:1px solid #ddd;'>"); // echo the table while (!feof ($cnx)) { // while not end of file $buffer = fgets($cnx); // get contents of file (name) as variable $values = explode(",", $buffer); //explode "," between the values within the contents echo "<tr>"; for ( $j = 0; $j < count($values); $j++ ) { // echo("<td style='border:1px solid #ddd;'>$values[$j]</td>"); } echo"</tr>"; }; echo("</table>"); fclose($cnx); //close filename variable ?>
-
hosker could you explain what your requirement is clearly?
-
thanks mjdamato i tried session values, but there are some issues for e.g. when iam opening http://localhost/index.php page $_SESSION['JEXEC'] is set to true. then i could access http://localhost/myproject/myfolder/myiinerpage.php directly by typing it on the URL since session is already set. my goal is to block direct access of http://localhost/myproject/myfolder/myiinerpage.php ------------------------------------------------------------------ also i don' think this would work ' A user could simply put a link into an HTML page with the full URL and the HTTP_REFERER will have a value ' i tried like you have told i.e .http://localhost/myproject/myfolder/myiinerpage.php, but the page said Access denied with the following code in the myiinerpage. php page if($_GET['myvalue '] == '' || $_SERVER['HTTP_REFERER'] == '')die("Access denied");
-
guys finally i found a solution, hope this is right, please contribute your ideas In my main index.php i changed function to this function loadpages(page) { var myvalue = "myvalue "; $jq('.mypage').load('myfolder/'+page,myvalue+"="+myvalue); } and in the myiinerpage.php i added a piece of code like this if($_GET['myvalue '] == '' || $_SERVER['HTTP_REFERER'] == '')die("Access denied"); i used $_SERVER['HTTP_REFERER'] just incase someone tries to access the page by directly typing the get value in url, also AyKay47 noConflict() is not necessary here, i just forgot to delete it.
-
hi PF2G try using ajax validation methods, it's a good approach check out the following links http://lastwebdesigner.com/featured/how-to-send-a-mail-with-php-ajax-and-jquery-in-facebook-style.html http://tutorialzine.com/2010/03/ajax-todo-list-jquery-php-mysql-css/
-
I have a main file index.php into which iam loading myinnerpage.php. I have defined a variable inside index.php & checks it on myinnerpage.php, but when i load innerpage it shows restricted access, any idea why? following is my code. index.php <?php define( '_JEXEC', true ); ?> <div class="mypage"> </div> <ul> <li><a href="#" onclick="loadpages('myiinerpage.php')">about page</a></li> </ul> <script type="text/javascript"> var $jq = jQuery.noConflict(); function loadpages(page) { $jq('.mypage').load('myfolder/'+page); } </script> and now in the myiinerpage.php which is in the folder myfolder i have the following code. <?php defined('_JEXEC') or die('Restricted access'); ?> <div> my page elements </div> but when i click on the link it shows restricted access. I have loaded jquery too, any idea y this is happening?
-
thanks SergeiSS that worked like a charm SELECT `myname` FROM mytable WHERE myuser = 'user' and myname='5412' iam a enthusiastic newbie to PHP, googled the saem topic but couldn't get an answer, now it looks fine
-
thanks SergeiSS, i think you are right, but WHERE myuser = 'user' is needed since each myname is related to specific users. anyways let me try out your code.
-
have you ever wondered how to select a single coloumn from mysql using php & checking whether a value or variable exists in the resulting array... well here is the code $busid = '5412'; $results = mysql_query("SELECT `myname` FROM mytable WHERE myuser = 'user'"); while($rows = mysql_fetch_array($results)) { $colnames[] = $rows['myname']; } if(!in_array($busid, $colnames))die("Access denied");
-
thanks buddy, your answer worked like a charm, thanks for your help.