Link to home
Start Free TrialLog in
Avatar of alg205
alg205Flag for United States of America

asked on

PHP file not working

I have a simple setup with a Server 2008 R2 running SQL Server 2012 and iis. I built a small database and entered sample data. I am now working on creating an interface to query the database. I have an index file with a button that calls on a php file. When i click on the button the php file is called but fails to work. I am knew to php and I am learning that is why I am working on this. I will attach the php code and hopefully someone can give me some insight. One more thing I did setup my ODBC and the test connection succeeded and php seems to be working (see attached screenshot). If you need more info just let me know. Thanks.


Jon
ViewCustomers.php
11-16-2012-10-57-17-AM.png
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

First of all request attention to delete the file you posted here: it show your password!
SOLUTION
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alg205

ASKER

Thank you for your concern about my password being exposed, however this is only a test server and its not public. I would never expose something like that if it were a production server. I fixed the errors you mentioned and the php appears to be working, however I am getting a odbc connection error. I will work on that and let you know. Any ideas? I will work on getting that fixed then I will close this and award points.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi, Jon. Not really worried about the points; I have enough points to orbit Saturn.  But I am very glad that you have gotten an error message.  That is important!

Possibly helpful:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms712362%28v=vs.85%29.aspx

http://social.msdn.microsoft.com/Forums/en/sqlgetstarted/thread/702f0d9b-6cb9-49cf-9953-80d059711e60
Avatar of alg205

ASKER

I got the connection issue sorted out. The connection problem was due to the fact that I was using a 64 bit odbc driver and 32 bit php. Fixed it by creating a connection under 32 bit odbc by lauching it through command prompt c:\windows\sysWOW64\odbcad32.exe  anyway here is the latest issue (see attached) I verified that I have data.
11-16-2012-2-30-12-PM.png
See line 34 where it says,

<p> class="footer">

Change that to...

<p class="footer">

Then try it again.  You might want to count the rows you're getting back from the query.  This function might be helpful (read the man page carefully to avoid surprises).
http://php.net/manual/en/function.odbc-num-rows.php
Avatar of alg205

ASKER

I got it all working now. Thanks for your help. I did fix the footer but I also had to fix the $SQL statement. SQL was caps on one and not the other.
Yep, that's the sort of thing that can happen when we can't test our code because we don't have the data base!  In PHP variable names are case-sensitive, but class and function names are not.  Thanks for the points and good luck with PHP ;-) ~Ray
Avatar of alg205

ASKER

Thanks for your help. I split the points.