grum
Posts: 42
|
| Posted: 05/24/2005, 4:41 AM |
|
I am using CCS 2.3 and MYSQL and PHP. I have a strange problem where my code works on my host but not on my local machine and I cannot figure out why?
I have the following script that is generated by codecharge: -
//Open Method @260-9D834628
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) FROM Employees_Certs " .
"LEFT JOIN Suppliers ON Employees_Certs.SupplierID = Suppliers.SupplierID " .
"WHERE Employees_Certs.EmployeeID = " . $this->SQLValue($this->wp->GetDBValue("1"), ccsInteger) . " " .
"AND Suppliers.CompanyID = " . $this->SQLValue($this->wp->GetDBValue("2"), ccsInteger) . " " .
"";
This code produces the following SQL Error in my local machine but works on my host.
Database error: Invalid SQL: SELECT COUNT(*) FROM Employees_Certs LEFT JOIN Suppliers ON Employees_Certs.SupplierID = Suppliers.SupplierID WHERE Employees_Certs.EmployeeID = AND Suppliers.CompanyID = 1
MySQL Error: 1064 (You have an error in your SQL syntax near 'AND Suppliers.CompanyID = 1 ' at line 1)
Session halted.
Can anyone suggest where I may have some settings different.
Regards
|
 |
 |
Nicole
Posts: 586
|
| Posted: 05/24/2005, 5:35 AM |
|
Grum,
This issue requires some debugging. You see that employeeID is empty
WHERE Employees_Certs.EmployeeID = AND
i.e. this code returns empty value
$this->SQLValue($this->wp->GetDBValue("1"), ccsInteger)
You need to verify settings of this parameter and make sure that its value is passed to the page.
_________________
Regards,
Nicole |
 |
 |
grum
Posts: 42
|
| Posted: 05/24/2005, 8:38 AM |
|
I am really baffled with this one. I could see that there was a problem with the SQL and looked into it. What I have is 2 identical sets of code (apart from database login etc).
The code works with no problem on my hosted service but not on my local machine. What I really struggle with is why its working on the host?
It must be PHP or mysql settings?
Any ideas?
|
 |
 |
peterr
Posts: 5971
|
| Posted: 05/24/2005, 10:10 AM |
|
Possibly you are not logged in to your app and UserID is blank on your desktop, while you have logged in to your app on the server?
Also, how does the data source of that form that causes the error look like?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
grum
Posts: 42
|
| Posted: 05/24/2005, 10:18 AM |
|
I am logged in ok. Basically I am adding a new user to a user table when I do this. What I have just disovered is that when I get the error and then refresh the screen (F5 or refresh) the user is added and it all looks fine.
I think it is somthing to do with running locally under XP Pro and the server being Linux and apache.
Any ideas?
|
 |
 |
peterr
Posts: 5971
|
| Posted: 05/24/2005, 10:53 AM |
|
I suspect that you'd need to provide more details.
How does the data source of that form that causes the error look like?
And are you creating any sessions on that page? How/when?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
grum
Posts: 42
|
| Posted: 05/24/2005, 1:06 PM |
|
I have been in contact with my hosting company. It looks like I may have a conflict between my local config (XP Pro, IIS) and hosted config (Linux/Apache).
The application code is working on the host and I am currently ensuring I have compatible versions of MySQL and the variables are in step.
Thanks for the help so far
|
 |
 |