CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 NEED HELP Urgent

Print topic Send  topic

Author Message
girish_327


Posts: 108
Posted: 06/18/2004, 4:47 AM

  
Function rating_OnValidate()  
if rating.ebook_id.value = CCDLookup("ebook_id","rating","user_id=" & CCToSQL(CCGetUserID(),"Integer"), DBebook) AND rating.ip.value  =   Request.ServerVariables("REMOTE_ADDR") then  
		rating.Errors.addError("You Can't Rate Same eBook Twice.")  
		else  
Dim SQL,ebookid,rate    
			Dim Connection    
			ebookid = rating.ebook_id.value  
			rate = rating.rate.value  
			SQL= "update ebook set rating=rating+" & rating.rate.value & ", rating_count=rating_count+1 where ebook_id=" & rating.ebook_id.value  
  
			Set Connection = New clsDBebook   
 			Connection.Open    
 			Connection.Execute(SQL)    
 			Connection.Close    
 			Set Connection = Nothing   
end if  
  
End Function   

Please Help Me out regardign Above Code. I have Made rating system for ebook Project. But I am facing follwigng problems
1) User only rate ebook once
2) After inserting in to Rating I want update ebook rating Counter and Rate Value in ebook Table
but above code have some mistake or something wrong that why its not validating if its validate then still its updating the counter.
Please Help Me what is the wrong in My Code.
_________________
Girish Baraskar
Web Designer/Developer
http://www.agnisdesigners.com
http://www.eindianpaintings.com
http://www.realestatekolhapur.com
View profile  Send private message
girish_327


Posts: 108
Posted: 06/19/2004, 11:19 PM

Solved My Self
Function rating_OnValidate() 'rating_OnValidate @80-2C9E7A95  
  
'Custom Code @116-73254650  
' -------------------------  
' Write your own code here.  
  
if rating.ebook_id.value = CCDLookup("ebook_id","rating","ebook_id=" &  ebook.ebook_id.value & "AND user_id =" & CCGetUserID(),DBebook) then  
		rating.Errors.addError("You Can't Rate Same eBook Twice.")  
	else  
  
			Dim SQL,ebookid,rate    
			Dim Connection    
			ebookid = rating.ebook_id.value  
			rate = rating.rate.value  
			SQL= "update ebook set rating=rating+" & rating.rate.value & ", rating_count=rating_count+1 where ebook_id=" & rating.ebook_id.value  
  
			Set Connection = New clsDBebook   
 			Connection.Open    
 			Connection.Execute(SQL)    
 			Connection.Close    
 			Set Connection = Nothing   
end if  
  
' -------------------------  
'End Custom Code  
  
End Function

_________________
Girish Baraskar
Web Designer/Developer
http://www.agnisdesigners.com
http://www.eindianpaintings.com
http://www.realestatekolhapur.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.