urtrivedi 276 Nearly a Posting Virtuoso

In future if you are going to post code and not a problem, then you should post it as code snippets.

Now you can not change your current post category, so leave it.

urtrivedi 276 Nearly a Posting Virtuoso
if (trim($link_one)!="")
    $db->query( "INSERT INTO " . PREFIX . "_post_links (matchid, link) VALUES('{$row}', '{$link_one}')" );

if (trim($link_two)!="")
   $db->query( "INSERT INTO " . PREFIX . "_post_links (matchid, link) VALUES('{$row}', '{$link_two}')" );

if (trim($link_three)!="")
   $db->query( "INSERT INTO " . PREFIX . "_post_links (matchid, link) VALUES('{$row}', '{$link_three}')" );


if (trim($link_four)!="")
   $db->query( "INSERT INTO " . PREFIX . "_post_links (matchid, link) VALUES('{$row}', '{$link_four}')" );
reco21 commented: Well done +1
urtrivedi 276 Nearly a Posting Virtuoso

I think you must use mysql function last_insert_id() when u insert data in tblscvdata

like

query1="insert into `tblEventAlert` ( `eventAlertID` , `enterpriseID` , `associateID` ..) values(null,'1','2')";

mysql_query(query1);

query2="insert into `tblscvdata` ( `scvDataID` , `header` , `deviceType` ..) values(last_insert_id(),'hdr','det')";

mysql_query(query2);
urtrivedi 276 Nearly a Posting Virtuoso

Its good that you are sharing useful stuffs for newbies, but you can post such things as "code snippets" rather then to regular posts.

urtrivedi 276 Nearly a Posting Virtuoso

I think loading all records in client is not good way of doing it when number of records are more then in tens.
So ajax-jquery combination is best way

you can learn jquery/ajax at

http://phpacademy.org/videos/index.php?all

urtrivedi 276 Nearly a Posting Virtuoso

This worked - as in it removed the time and just left the date - however it switched all the dates to 1970-01-01

Not sure why as it should just be formatting.....

It will not work because php date and mysql date do not recongize each other.
So when you load php variable with mysql datevalue, its just string for it not date.
So we first convert that string to php date object using strtotime function.
then we use that php date object using various php display formats

urtrivedi 276 Nearly a Posting Virtuoso

if you want to delete things, on path_id from the related table, so best thing is create foreign keys in all related table with cascade delete option

urtrivedi 276 Nearly a Posting Virtuoso

You can use session variable or HTML HIDDEN ELEMENT

urtrivedi 276 Nearly a Posting Virtuoso

change your columns names accordingly

select customer, sum(case when month(datecolname) in (1,2,3) then quantity else 0 end) jan_mar
sum(case when month(datecolname) in (4,5,6) then quantity else 0 end) apr_jun,
sum(case when month(datecolname) in (7,8,9) then quantity else 0 end) jul_sep,
sum(case when month(datecolname) in (10,11,12) then quantity else 0 end) oct_dec
from tablename
where  month(getdate())=2011
group by customer
urtrivedi 276 Nearly a Posting Virtuoso

change your line with line given below

echo $buyer_query="select * from buyer_detail where company_id='{$row['c_id']}' AND buyer_id='{$_GET['buyer_id']}'";
urtrivedi 276 Nearly a Posting Virtuoso

I think problem is in the page which is calling this page and not on this page.
Check the spelling of your form elements in previous form.

urtrivedi 276 Nearly a Posting Virtuoso
<html>
 
 
<script language="javascript"> 
 
	function validate(dt1,dt2)
	{
		
		var jdt1=Date.parse('20 Aug 2000 '+dt1);
		var jdt2=Date.parse('20 Aug 2000 '+dt2);
		alert(jdt1);
		if(jdt1==NaN)
		{
			alert('invalid start time');
			return false;
		}
		if(jdt2==NaN)
		{
			alert('invalid end time');
			return false;
		}
	  	if (jdt1>jdt2)
		{
			alert('start is greater');
		}
		else
		{
			alert('start is less equal');
		}
	
		
	}
	
</script>
 
<body>
<div>
 
 
<form name=frm id=frm action=temp.php method="get" accept="text/csv">
<P>&nbsp;</P>
start <INPUT id=txt1 name=txt1 value='10:30:05 am'>&nbsp; <br>
end <INPUT id=txt2 name=txt2  value='10:40:05 am'>&nbsp; 
<input type=button value=ok id=button2 name=button2 onclick ='validate(document.frm.txt1.value,document.frm.txt2.value)'>&nbsp;&nbsp; 
 </P>
</form></div>
<script language='javascript'> 
</script>
<div id="txtHint">&nbsp;
</div>
<P></P>
 
</body>
</html>
karthik_ppts commented: Helpful post +6
urtrivedi 276 Nearly a Posting Virtuoso
select date_format(datecolname, '%d-%m-%Y') as formated_date from tablename
urtrivedi 276 Nearly a Posting Virtuoso

if form method is post then in processing page u can access submitted form values bye following way

echo $_POST['t1'];
echo $_POST['t2'];
echo $_POST['h1'];

in case of get method

echo $_GET['t1'];
echo $_GET['t2'];
echo $_GET['h1'];
urtrivedi 276 Nearly a Posting Virtuoso

its not like below or above,
The important thing is that input elements must belong to some form element like

<form name=frm id=frm action='processpage.php' method='post'>
<input type=text value='' name=t1>
<input type=text value='' nam2=t2>
<input type=hidden value='1223' name=h1>
<input type=submit value='Proceed' name=submit1 >
</form>

In above form code, when user press submit, the form values like t1, t2 and h1 will be submitted to processpage.php

urtrivedi 276 Nearly a Posting Virtuoso
var date = "<?php echo $date1; ?>";

I think this is the best way to access php in javascript. so you go ahead, I dont think you will get any problem in this.

urtrivedi 276 Nearly a Posting Virtuoso

Two ways to do this, as fields value is fluctuating,
1) One is keep level field in usermaster table and whenever score is updated, update level column in usermaster, using insert/update/delete database trigger.

2) another way is, do not create level field in any table
rather, create one view say user_level by joining usermaster table, score table and levelmaster table(with max min values defined for each table). this view will always show u appropriate user level depending on his/her score and min-max value from levelmaster table.

urtrivedi 276 Nearly a Posting Virtuoso

hidded field are used to for additional information , that user may not need to enter
or sometime it is used to store some parameters passed by previous page,

that will be used along with other input elements in the processing page.

urtrivedi 276 Nearly a Posting Virtuoso

&nbpsp; is not required its of no use, its only useful in html code, quote your fname around quotes.

<?php
.
.
.
echo "<script language=javascript>alert('$fname');
window.location='reservation1.php';</script>";
.
.

?>
urtrivedi 276 Nearly a Posting Virtuoso

you can create two separate pages for say
1) current
2) archive

the difference is only in query

for current

select * from tablename where deadline>current_date()

for archive

select * from tablename where deadline<=current_date()
urtrivedi 276 Nearly a Posting Virtuoso

in new page you can use php variable in javascript following way

<?php
.
.
.
$query = mysql_query("
INSERT INTO reservation VALUES('','$fname','$email','$pnum','$numofperson','$numofroom','$roomtype','$cur_date','$time2','$date_value','$stay','pending','$tot2','$tot2','0')
");
.
.
.

?>
<html>
<script lang='javascript' >
function myfunction()
{
   var firstnm="<?php echo $fname;?>";
  
   alert(firstnm);
   
}

</script>
urtrivedi 276 Nearly a Posting Virtuoso
SELECT b.CODE, b.NAME,a.BUYER, AVG(a.TOTAL) AS total 
FROM SMF a
WHERE  a.PERIOD1 > DATEADD(YEAR, -10, GETDATE())
group by b.CODE, b.NAME,a.BUYER
having AVG(a.TOTAL)>100000 
inner join ACCODE b on b.CODE = a.BUYER
urtrivedi 276 Nearly a Posting Virtuoso

following code is fine

header('Location: http://www.example.com/'); //redirects user
exit;

you can ask your server administrator HOW TO SET DNS property. They might help you to map ip<->domain.

urtrivedi 276 Nearly a Posting Virtuoso

php is case sensitive language so use all capital letters for SESSION

if ($_SESSION['LoggedIn'] !=null)
urtrivedi 276 Nearly a Posting Virtuoso
$confirmation = ($result)? "Data telah terhapus.":"Gagal menghapus data.";

You are setting confirmation in if condition so it is giving warning when you tried to used unintialise variable.

so before your if statement you write

$confirmation="";
urtrivedi 276 Nearly a Posting Virtuoso
SELECT * 
FROM `tablename` 
WHERE date_add( current_date(), INTERVAL -1
MONTH ) < date_colname
urtrivedi 276 Nearly a Posting Virtuoso
$list=implode(",",$q);

$query=" SELECT * 
FROM table 
WHERE ID in ($list)";
urtrivedi 276 Nearly a Posting Virtuoso

Php is server side lanaguage so it will always shows date time of server where the script is installed.
You date time zone depends on UTC setting on your webserver.

If you use javascript date, it will show date time of the local computer where your page is opened.

urtrivedi 276 Nearly a Posting Virtuoso
SELECT `date`,`destination`,`callsec`,`tbl_cost`,`callsec`*`tbl_cost` AS price,
trim(substring(destination,1,length(tbl_code))) billcode , trim(tbl_code) feecode
 FROM  billing left JOIN `fees`  ON  trim(substring(destination,1,length(tbl_code))) =trim(tbl_code)

1) What is output of this query?

2) check Do you have code starting with 083 or 83 in fees table?

urtrivedi 276 Nearly a Posting Virtuoso

Following query may work but this may cause to slow down performance.

SELECT `date`,`destination`,`callsec`,`tbl_cost`,`callsec`*`tbl_cost` AS price FROM  billing left JOIN `fees`  ON  substring(destination,1,length(tbl_code)) =tbl_code
urtrivedi 276 Nearly a Posting Virtuoso
SELECT * FROM billing order by tbl_code
SELECT * FROM  fees order by tbl_fee

You run this 2 queries separately and post both exact results here (few top rows)

urtrivedi 276 Nearly a Posting Virtuoso

Here i have added 2 lines is begining to check error
I have commented if check=0 to see whether result comes or not
try following code

<?php
	error_reporting(E_ALL); 
	ini_set("display_errors", 1); 
// Before this, I have connected to the database (succesful) and has selected the database too.
        $checkrow_query = "SELECT * FROM posts WHERE username = '$prof_real_username' order by post_time desc limit 10";
	$checkrow = mysql_query($checkrow_query);
	$checkrows = mysql_num_rows($checkrow);
/*	if(!$checkrows)
	{
		echo "<div class=special\">This User Hasn't Submitted any links.</div>";
	}
	else*/
	{
	
			// Start Loading
			$times = 0;
			while($postrow = mysql_fetch_array($checkrow))
			{
				echo "<div class=\"userscoop\"><h3><a href=\"" . 
				$postrow['post_url']. 
				"\">"
				. $postrow['post_title'] .
				"</a></h3><p>" . $postrow['post_desc'] . "</p>
				<span class=\"time\">" . $postrow['post_time'] . "</span>
				</div>";
				$times++;
			} // User Scoop Loading Ends
	}

?>
urtrivedi 276 Nearly a Posting Virtuoso

When I run your command it show the same result the whole time.

What do you mean by that, The query is perfect.

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

1) what are columns name of both tables?
2) Is you table 2 holding value as 'fee 011' (will it always have fee prefix in all records) or table 2 is holding 011, 012 like that

urtrivedi 276 Nearly a Posting Virtuoso

Database will handle the performance in better manner doesnot matter how many records it have.

If you say your design is right, then tell me how u relate subject table with marks,
I guess u are storing marks obtain in sub1, sub2, so where are you storing subject id

Marks has mark_id, student_id(FK), exam_id (FK), sub_1, sub_2, ... sub_n


Even if we use your design, then you need to add one more column.

Marks has mark_id, student_id(FK), exam_id (FK), subid_1, submarks_1, subid_2, submarks_2, ... subid_n, submarks_n

The query you are trying to achieve is impossible and non standard. Please understand due to your design you struck badly.

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

You are facing the problem due to your wrong design.
I will suggest you to change the design, otherwise you will end up with un managable system.


Subjects { subject_id (PK), subject_name & class_id (FK).}
Marks { mark_id, student_id(FK), exam_id (FK), subject_id(fk), marks_obtained}

debasisdas commented: agree +13
urtrivedi 276 Nearly a Posting Virtuoso

I think you must save html code for each element in database. For example you keep few default input element in database say (id, html_code)

Populate all id with html_code on left side as sample, so when some one click any id button. copy corresponding code to your new design division.

In jquery you will easily find inner html to save in database.

I hope I am on the right track.

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

php.ini is to be modified for limit of file size. html parameter will not help

urtrivedi 276 Nearly a Posting Virtuoso

Its depends on your database structure, php has noting to do much about it.

urtrivedi 276 Nearly a Posting Virtuoso

remove this line from loginform.inc, you have already included core.inc.php.

require 'core.inc.php';

or use

require_once('core.inc.php');
urtrivedi 276 Nearly a Posting Virtuoso

I think this could help you.

$row_rs_propdetails['add_date']=strtotime($row_rs_propdetails['add_date']);//this will convert mysql text date to php date object
echo  date('Y-m-d',$row_rs_propdetails['add_date'] );//now show date object in required format
urtrivedi 276 Nearly a Posting Virtuoso

how u form the list of 5000 items, is it somewhere stored in same database. or you do it in your front end.

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

batchmaster
batchid, batchname
1, batch1
2, batch2
3, batch3

studentmaster
studid,studname,batchid, emailid
1, abc, 1, ab@yahoo.com
2, pqr, 1, pr@yahoo.com
3, xyz, 1, xz@gmai.com
4, rms, 2, rms@gmail.com
5, opm, 2, pmo@gmail.com
6, abc, 2, bc@yahoo.com

In any table to avoid chaos or confusion we shold always select one primary key. primary key is used to identify each row distinctly, means when u say studid 6, you will find row with studid id 6 easily,
But if you same studname abc, then you will not able to decide which record to refer, 1 or 6.

Here In table batchmaster
we select batchid as primary key and in studentmaster we select studid as PK


Foreign key
It is used to refer details of other table to avoid duplicate entries. To mention batch for rms we only refer to its batch id and not whole batchname.

so batchid column in studentmaster table is know as foreign key as its details are found in some foreign table, we just store reference to it

UNique key
Some time in table you will need row values to be unique like emailid, userid like that. but you already have one primary key i n studentmaster so, we will set emailid to unique key.

Unique key help us to avoid entry of duplicate email ids in studentmaster

urtrivedi 276 Nearly a Posting Virtuoso

download php-tcpdf libraries, it has feature to build barbodes with pdf report.

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

you need to quote around date and text, only numbers are allowed to write without qoutes

so
1) do not change your datatype
2) post your query (not output) only php mysql query with variables names, i will prepare query for you.