Using PHP to get data from SQL Server


#21

Hi Ernie

Actually I did not make a decision to go with javascript. I was using that as an example to illustrate what I was trying to do since the other member failed to grasp my issue. Perhaps you may be able to guide me, perhaps not but it is worth a try.

The point of mentioning javascript was because I can create a directory structure, copy it to another machine and I can have a simple app with ease of installation and minimal overhead. I am looking for the simplest way to add database access to that. I also ran across ruby, perl and python. My understand of those options is the code will be parsed which is less overhead than a server. A server must always be running. A parser gets invoked only when needed. Correct me if I’m wrong. I do not know how these technologies work.

I was hoping for a suggestion on which of those three would be the best choice for further investigation for ease of installation and smallest footprint. Any ideas? I’d be happy to post my solution when I am done. If you wish to mark it solved just to close it then thats fine too.


#22

JohnM,

Yes, PHP runs on a server. A real one or an emulation such as Wamp. (Wamp simulates a Linux server)
You were not clear on how it was planned to be used until now. If you are just going to use it on another
computer, I would stick with .NET. Just create your VB.NET or ACCESS.NET and create an install file that will
also create your directories that are needed.

ACCESS.NET is really designed to use a database and create reports from the data. If that is only what you
need, then, I would just use that. Just create an install file for it and it’s done. If your plans for the future
is to scale-up the system or allow for users to access the system over the internet, then, you need one PC
to become your server which would hold the database.

So, from what I have read, you really only want to have a program (application) that runs on one system
and has the database on that one system. And, you want it to have zero footprint until it is being used.
Well, that is the description of program or application. Not a shared application nor web system. In that
case, you do not need a server.

Not needing a server brings you full-circle to using a desktop system. Something like VB, ACCESS, Java or
other language that can be compiled into a distributable runtime package. The ACCESS program you now
have can do that. Just compile the program into an install file and distribute that to the other(s) computers.

Javascript, Perl, VBscript and a lot of others are just scripting languages which are basically text files and
they could be zipped up and unzipped on the other machine. Not a secure system as anyone can alter the
files, so again, little security there. But, if the other systems are trusted users and systems, less of a worry.

Not sure if all that helps or mixes you up further. With that said, Ruby-on-Rails is a framework, so there is
overhead on that somewhat. Normally when someone mentions “database” on a PHP site such as here, it
means unsaid internet or server or shared machine thru a LAN. So, that is why there was confusion earlier
on.

Well, more fuel for the fire? Sometimes design is the worst step in the project… Good luck!


#23

Instead of retyping my requirements I will quote an earlier post.

You proposed answer does not meet the requirements nor does it answer my question. First of all there is no such thing as ACCESS.NET. Access is an application that uses VBA. .NET is a set of common libraries used by a set of languages. I’ve done Access programming and it fails to meet the above requirements I quoted for you. Ditto for .NET

There is no install for a well designed Access program (database). All you need to do is copy the database to another computer and open it. There is also no compile step. Think about one more thing. Why would I ask about some other language if what we had was sufficient. Because it is not. Management does not ask me to replace a program that does not need to be replaced. I am aware of the limitations of it.

You seem like you want to help, but I do not understand your technique.

Answering the question is helpful.
Inventing your own question is NOT helpful.
Answering some other irrelevant question is NOT helpful.

Look how long this thread is. It took a page and several posts to learn that PHP is not the best choice. I asked previously about database access and perl, ruby and python. Instead of getting an answer I got a lot of an attempt to help which was not helpful. An answer to the question would be helpful.


#24

And why are you still here?


#25

Why did you reply? This is interesting. If you do not answer posts to help people then there must be some other reason. I have some theories but this is not the place to discuss them.

Did you forget so soon that when I asked a php question YOU told me to use .NET? If you can wander off the topic to something totally unusefull then why can’t I wander off topic to something that is actually useful?

Ernie appeared to really be interested in helping. Leaving will not find out. He may actually answer my question, he may not. Leaving will also not tell me if he will provide anything useful.


#26

Out of those languages you listed, since you didn’t actually say if you knew them or were grasping at straws, one of the easiest to pick up and deploy how you want will be Python, and using this will allow the installation without the extra overhead.

I may be aggravated with you, but you were looking for help even if your taking advice needs work. The above will meet your needs (CRUD and simple install without requiring a server). However, you will still need to learn python.


#27

Thank you for your help. But you must understand just because you think your advice is good does not mean it really is good. Bad advice should always be discarded.

I appreciate the link. It may meet your perceived solution but it does not meet mine. I stated before (more than once) and I am stating again. I want to use HTML to achieve platform independence. Windows is not platform independence. It is actually quite the opposite. I already have a windows solution. It makes no sense to create another inadequate solution with the original problem remaining intact.

No where did I ever ask for a windows solution. Yet you went through the effort to help me (which is good, I respect that) but did little to actually understand the question.

I really can’t think of any other ways to say “platform independent.”


#28

Then write it in Java. cross platform availability.

I don’t know how many times you have to be told that what you want to do is not feasible in it’s current design. HTML does not interact with a database. You HAVE TO HAVE a server to run a server side language like PHP even if you use JavaScript as the middleman and use AjAX on the client. I cannot be more clear.

So, to reiterate, you cannot just drop a HTML page on a desktop and it work without a server running somewhere that it connects to the database. I and Ernie have pointed that out. You keep saying that I am not listening, when you obviously are not understanding what is coming from someone whom does this type of thing everyday. I have offered other possibilities that you ignore. You want to put force your solution when it will not function that way.


#29

You misunderstand, again. We already HAVE a database server. The original solution you provided required an ADDITIONAL server. That extra server is what I wish to avoid. You are confusing your ADDITIONAL server with the one we already have running.

Did you ever wonder why I was asking about php, python, ruby and perl? It is because HTML does not interact with a database. Again you fail to understand. No wonder all your solutions were inadequate.

I told you if you are unclear ask for clarification. Instead you assume you know the entire scope and assume you are correct. Two dangerous assumptions.

Another incorrect assumption is that I wish to drop a HTML page on a desktop. I said I would like to DISPLAY the information in HTML. It could be generated on the fly. But that concept is probably pass your reasoning.


#30

This is the last time I am going to say it and hopefully you understand this time,

I don’t care how you want to display it. In order for a process to work

  1. You have a program with controls to interact with a user
  2. The user tells the computer what they want it do do using those controls
  3. The computer does them.

If you are going to have a centralized system:
A program would have to be housed somewhere ( the server that you are completely against )
The user would need a way to interact ( GUI for instance )
The program requests the data from the database
The program ( ie server ) would serve the data that user requests

The only way around that would be to write a program that interacts with the database directly. You want XOS compatibility? I suggested Java, that is what it does with the least amount of overhead, because most computers already have the JRE installed and running. Which I believe you were against as well.


#31

Further proof that you don’t know what you are asking for:

I want to use html running on a desktop to receive user selections from a database (get a drawing based on a part number or other specifications).

HTML is parsed in a browser. The server side language does what you are asking for. If it was as easy as you say there would be no need for PHP, RoR, ASP, or NodeJS.


#32

Thank you captain obvious. But you are wrong.

There are many client programs that do not live on the server. Our current implementation is one of them. The access database lives on the client. It access the data on the server and presents it on the client. Too bad you do not get it, its a basic design.

This shows your limited thinking. There are other ways to accomplish the task. Now I know why you were unable to help me. Your rigid “in-the-box” thinking prohibits you from seeing alternate solutions. Thank you for clearing that up.

It is very easy to run code on a machine, collect data, build a HTML page and display it. But it seems that comcept is beyond your thinking. Thanks anyway.


#33

It also shows your limited knowledge. An Access database is not a real database, it is a flat file system and gaping reason why it is not used for large applications. It does not use a server although its files can be hosted on a share drive.

Which requires a program that would do it, outside of your skill set obviously.

This topic is now locked. You want to go around in circles over something that you are under qualified to speak about and complain when people who actually work on things other the a pretend database and VBA, Access since I likely lost you, attempt to explain how real systems work.

If you need further help, I suggest talking to RotAir’s IT department. Granted they will probably tell you that it is their problem and not customer services to create such a thing, but thanks for your visit!


#34

JohnM,

Everyone has offered good advice, but hopefully I can clear things up. 

Can I use PHP to read from the sql server database? Yes, You can.

I do not need a dynamic page but a static page with a combobox populated with data from SQL Server. - This is a dynamic page, since you are reading from a database - they data may never change but it’s still generated from a database. It’s just terminology

[php]Can this be done with PHP? If so can a link be provided with a sample or tutorial? [/php] Sure, But here’s the rub. Are you planning on running PHP on a windows Server? Or a Linux Box? I’m going to assume windows. Then you need to installed a web server, windows comes with IIS (Just need to add the role to the server) - So most people will use that. But some people will prefer to install Wamp, lamp, etc on windows and use that as a web server.

If you want to install PHP on IIS - Just click the install button located here: http://php.iis.net/

Now you just can’t google for php and Sql Server tutorial and be happy. If you put the latest version of PHP 5.6.x all the tutorials that use MSSQL as a driver will not work, support ended in 5.3. You have to get a tutorial where they use SQLSRV as a driver.

http://www.knowledgebase-script.com/kb/article/using-the-microsoft-sql-server-driver-sqlsrv-for-php-37.html

Start Small - Get little bits working - then ask if you get stuck.

If you program in .net - most things should be self explanatory. If you want a platform independence using .net - You can achieve that by using .NET vNEXT, which is essentially .net 5.0

http://www.asp.net/vnext

It’s in preview release and fully open source now.

Good Luck - This topic is now locked - If you need additional help start a new one :slight_smile: