You have an error in your SQL syntax; check the manual that corresponds to your MySQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sathishauit

    #1

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL

    Code:
    <?php
    require_once ("inc/dbconnection.php");
    
    class provider_function
    {
     public $select_query;
     public $select_result;
     public $insert_query;
     public $insert_result;
     public $update_query;
     public $update_result;
     public $select_row;
    		public function select($id)
    		{
    			$this->select_query = "SELECT * FROM m_tbl_ServiceProvider where intProviderID =".$id;
    			$this->select_result = mysql_query($this->select_query) or die(mysql_error());
    			$this->select_row = mysql_fetch_assoc($this->select_result);
    			return $this->select_row;
    		}
    		public function insert($bo)
    		{
    			$this->insert_query="INSERT INTO m_tbl_ServiceProvider (str_Name,str_AgencyName,str_Address1,str_Address2,str_City,int_PinCode,str_Email,str_FromDay,str_ToDay,str_HourAm,str_HourPm,int_PhoneNumber,str_LoginName,str_Password,str_ProviderType) VALUES 
    															 ('".$bo->str_Name."','".$bo->str_AgencyName."','".$bo->str_Address1."','".$bo->str_Address2."','".$bo->str_City."',".$bo->int_PinCode.",'".$bo->str_Email."','".$bo->str_FromDay."','".$bo->str_ToDay."','".$bo->str_HourAm."','".$bo->str_HourPm."',".$bo->int_PhoneNumber.",'".$bo->str_LoginName."','".$bo->str_Password."','".$bo->str_ProviderType."')";
    			$this->insert_result = mysql_query($this->insert_query) or die(mysql_error());
    			return $this->insert_result;
    		}
    		public function update($id,$bo)
    		{
    
    			$this->update_query = "update m_tbl_ServiceProvider set str_Name = '".$bo->str_Name."',str_AgencyName = '".$bo->str_AgencyName."',str_Address1 = '".$bo->str_Address1."',str_Address2 = '".$bo->str_Address2."',str_City = '".$bo->str_City."',
    															  int_PinCode=".$bo->int_PinCode.",str_Email='".$bo->str_Email."',str_FromDay='".$bo->str_FromDay."',str_ToDay='".$bo->str_ToDay."',str_HourAm='".$bo->str_HourAm."',str_HourPm='".$bo->str_HourPm."',
    															  int_PhoneNumber=".$bo->int_PhoneNumber.",str_LoginName='".$bo->str_LoginName."',str_Password='".$bo->str_Password."',str_ProviderType = '".$bo->str_ProviderType."' where intProviderID=".$id;
    			$this->update_result = mysql_query($this->update_query) or die(mysql_error());
    			return $this->update_result;
    		}
    }
    ?>
    when ever i call this function the following error wil come please clarify my problem

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''janu','sat',' Handyman Services')' at line 2
    Last edited by Atli; Oct 16 '10, 03:32 PM. Reason: Please use [code] tags when posting code.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    On line #23, there looks like there is something wrong with the $bo->int_PhoneNumbe r value. Are you sure it has a value?
    Last edited by Atli; Oct 16 '10, 03:37 PM. Reason: Misread the code.

    Comment

    Working...