tapananand commented: I didn't know there is a function to calculate sum of array as well. PHP just doesn't want us to do anything. +2
I guess, You have to do on your own. If you are not developer then you may post this question in business exchange forum. You will find so many who can do it for you.
I am not sure following will help you or not, but here are some paid and free scripts
remove line 26 to 28 in your html code, your html elements and submit button must be under same form element. You have ended form early
</form>
<br> <form action="insert.php" method = "post">
Your insert form must look like following
<form action="insert.php" method="post">
<h3 style="text-align:center;">
<label for="Firstname">First Name:</label> <input type="text" name="Firstname" /><br/>
<label for="Lastname">Last Name:</label> <input type="text" name="Lastname" /><br/>
<label for="Age">Age:</label> <input type="text" name="Age" /><br/>
<br class="clear" />
<input type="submit" value = "Save">
</form>
if you see line 22, 23, 24
all input names are in small letters
firstname
lastname
age
and in your php handler code in your first post its in title case. Line 33,34,35
Firstname
Lastmame
Age
Both case must match as php is case sensitive like C language
Post your html code also
I am changing 4 lines of your student_login_handler.php
Line 7
$query = "select student_id,last_login_date from student_information where learner_id='$learner_id' and student_password='$student_password'";
Line 16
$_SESSION['user_id'] = $date['student_id'];
Line 19
mysql_query("UPDATE student_information SET last_login_date=now() where student_id='{$_SESSION['user_id']}'",$link_id);
Line 23
header("location: Student_Home.php?id={$_SESSION['user_id']}");
Reasons:
1) Your html part is not having LastName , Age elements properlly spelled
2) Your input method may be GET instead of POST
SELECT * FROM `users` WHERE
(
uid not in (select friend_two from friends where friend_one='$uid' )
and
uid not in (select friend_one from friends where friend_two='$uid' )
)
post your structure and sample data here
I guess problem is in your join
LEFT JOIN friends F ON U.uid=F.friend_one
You already joing uid with freind one , with that query you willl never receive result.
can you post both sample table script and sample data here or at http://sqlfiddle.com/
I guess sublime text is just an editor with good features for progammers. But any simple notepad is enough to write php code.
create text file name it as HelloWorld.php (or any name with extension as php)
open it and write following code
<?php
echo "this is php code";
echo "Hello world";
?>
<h1> This is html code </h1>
<h2 > this is <?php echo "php embeded in html"; ?> </h2>
Save that file in your web root directory and open it with appropriate location in any browser.
url : http://localhost/anyfolder/anysubfolder/HelloWorld.php
Try to Use distinct keyword in your query
$dropdownquery="select distinct col1,col2 ....";
$query = "SELECT * FROM po
wHERE (date = str_to_date({$searchString},'%m-%d-%Y') || date like str_to_date ({$searchstring},'%m-%d-%Y)) ";
We use explode fuction with seperator / , so it will give you array of size 3, then you can concate it as shown below
$datearr=explode("/",$myDate);
$dbdate=$datearr[2]."-".$datearr[0]."-".$datearr[1];
I have changed your first query
1) added 2 columns in group by
2) added where clause according to your second query
$sql = "select id,date,category,sum(q1) Total,sum(q2) Total2,sum(q3) Total3,sum(q4) Total4,sum(q5) Total5,sum(q6) Total6 from articles WHERE from_date >= '".mysql_real_escape_string($_REQUEST["from"])."' AND to_date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city." group by category order by id, date,category ";
try following as i suggested before
where f.friend_two <> '$uid' and F.friend_one <> '$uid'
To get correct result
1) I think you need to join clause to join users U, friends F
2) need to put where f.friend_two <> '$uid' and F.friend_one <> '$uid'
Your requirement is just grouping, its does not look like tree
You can do this using two queries
$cityquery= "select distinct city from usertable"
loop -- through above records and in loop fetch users for the city
echo $cityrow['city']
$userquery "select usernaem from usertable where city='{$cityrow['city']}'";
loop
echo " ".$userrow['userid'];
end loop
end loop ---city
Simply the page that you want to show to public users, do not keep session check in such pages.
I have put coluname in query as told by djbirdi and I have put alias a after parenthesis. Try with alias
$query=mysql_query("SELECT COUNT(*) AS total FROM (SELECT uid_fk FROM message_believe WHERE message_believe.uid_fk ='$uid' UNION ALL SELECT uid_fk FROM review_believes WHERE review_believes.uid_fk ='$uid' ) a");
I have put alias a after parenthesis. Try with alias
$query=mysql_query("SELECT COUNT(*) AS total FROM (SELECT COUNT(*) FROM message_believe WHERE message_believe.uid_fk ='$uid' UNION ALL SELECT COUNT(*) FROM review_believes WHERE review_believes.uid_fk ='$uid' ) a");
so where you put the code you shown in your fist post?
set javascript global variable onload
that warn=1;
but in onsubmit set warn= 0;
Then on unload, you can see variable value and put alert
<script>
window.onbeforeunload= function() {
if (warn==1 ) return "Save your data plz"; };
</script>
Where is your code, and what error you get while running your script?
what u have did till now?
you must have column in table foto that its vidoe or image. Use if condtion based on that column value to chose your html code
Hericles, Now I guess users thinks that moderators are OMNISCIENT
Put that in begining of your code
set_time_limit(2000);
I agree with hericles.
But as temporary solution following should work
SELECT
a.price,
b.price
FROM table1 AS a
INNER JOIN table2 AS b ON a.sku = b.sku
ORDER BY case when a.price>=b.price then a.price else b.price end desc
Now you have query, you can tweak around it. Though run following one also, I have changed b.type<>d.type to b.type=d.type. My query assumes that your date column is also having time part as you mentioned in your above post.
If your date column is not having time part, then query may not work properly
select a.maxtime maxtime_firstday,b.type type_firstday,
c.mintime mintime_secondday, d.type type_secondday
from (
select
DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 1) nextday,
max(tlogs.Date) maxtime from tlogs group by DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 0),
DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 1)
) a
left outer join tlogs b on a.maxtime=b.date
left outer join (
select DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 0) currday,
min(tlogs.Date)mintime from tlogs group by DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 0)
) c on a.nextday=c.currday
left outer join tlogs d on c.mintime=d.date
where b.type=d.type and a.maxtime between '2014-01-01' and '2014-01-31'
if you run all part by part you can understand
set 1
SELECT cashid, sum(amt) AS ramt, NULL AS pamt
FROM receipt WHERE cashid IN ('17','23') GROUP BY cashid
set 2
SELECT cashid, sum(amt) AS ramt, NULL AS pamt
FROM receipt WHERE cashid IN ('17','23') GROUP BY cashid
set 2 = set 1 union set 2
SELECT cashid, sum(amt) AS ramt, NULL AS pamt
FROM receipt WHERE cashid IN ('17','23') GROUP BY cashid
UNION ALL
SELECT cashid, NULL AS ramt, sum(amt) AS pamt
FROM payment WHERE cashid IN ('17','23') GROUP BY cashid)
now set 3 is base table for us and simple sum and subtraction performed on set 3
echo array_sum($points)/count($points);
SELECT cashid, sum(ramt) ramt, sum(pamt)pamt, ifnull(sum(ramt), 0)-ifnull(sum(pamt), 0) balance
FROM (
SELECT cashid, sum(amt) AS ramt, NULL AS pamt
FROM receipt WHERE cashid IN ('17','23') GROUP BY cashid
UNION ALL
SELECT cashid, NULL AS ramt, sum(amt) AS pamt
FROM payment WHERE cashid IN ('17','23') GROUP BY cashid)
AS bal
GROUP BY cashid
I am looking into it
select a.maxtime maxtime_firstday,b.type type_firstday,
c.mintime mintime_secondday, d.type type_secondday
from (
select
DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 1) nextday,
max(tlogs.Date) maxtime from tlogs group by DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 0),
DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 1)
) a
left outer join tlogs b on a.maxtime=b.date
left outer join (
select DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 0) currday,
min(tlogs.Date)mintime from tlogs group by DATEADD(dd, DATEDIFF(dd, 0, tlogs.Date), 0)
) c on a.nextday=c.currday
left outer join tlogs d on c.mintime=d.date
where b.type<>d.type and a.maxtime between '2014-01-01' and '2014-01-31'
function insert_csv($data)
{
$query = $this->db->query("select count(*) cnt from category where cat_id='{$data['cat_id']}'");
$row = $query->first_row();
if(trim($data['cat_id'])!="" && $row->cnt==0)
$this->db->insert('category', $data);
}
function insertcsv($data)
{
$query = $this->db->query("select count(*) cnt from sub_category where sub_cat_id='{$data['sub_cat_id']}'");
$row = $query->first_row();
if(trim($data['sub_cat_id'])!="" && $row->cnt==0)
$this->db->insert('sub_category',$data);
}
I am asking for mysql script and sample csv file you upload
select cashid, ramt, pamt, ifnull(ramt,0)-ifnull(pamt,0) balance from (
select cashid, sum(amt) as ramt, NULL AS pamt from receipt where cashid in ('17', '23') GROUP BY cashid
union all
select cashid, NULL AS ramt, sum(amt) as pamt from payment where cashid in ('17', '23') GROUP BY cashid
)
group by cashid
attach here your php file ,sample csv file and mysql table script, so that your code can be tested here
at line 145 after while loop you can check $row variable
If ($row==0 )
echo "UPLOAD FILE WITH PROPER RECORDS";
This is going to be complicated for you.
Whenever you store time, You should store it as date time.
That will help to analyse things in better manner.
You should have keep only single datetime column instead of 2 separate columns
Right now if you run max min fuction on your time column (as now its text field I guess), your query will return 08:00 as max value
You may use on duplicate phrase, if your table has proper primary key or unique key combination. It wil not give any error on duplicate value insertion, rather it wil update it accoding to what you set to update
$sql = "insert into table (col1,col2) values (val1,val2) on duplicate key update col1=val1";
What diafol suggested looks like the best possible solution.
I agree with pritaeas
if (!isset($_GET[screen]))
$screen = 0;
else
$screen=$_GET[screen];
ever changing means what,
how frequently columns sequence changed?
hourly, daily, weekly , monthly ???
I think you do not need where condition, following should work
$sql="select playername from tablejollys order by rand() limit 1";