Jump to content

beginning SQL for first time


CNT

Recommended Posts

<?phprequire_once("DB.php"); $db =& DB::connect("mssql://user:password@host:1433/membership");if (DB::isError($db)) {  die($db->getMessage());}$db->setFetchMode(DB_FETCHMODE_ASSOC); $res = db->query("EXECUTE member_list");if (DB::isError($res)) {  die($res->getMessage());} echo "<table>n<tr>n<th>Name</th><th>Address</th><th>Email</th>" .   "<th>Expiration</th>n</tr>n";while($row =& $res->fetchRow()) {  printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>n",   $row["name"], $row["address"], $row["email"],   $row["expiration"]);}echo "</table>n"; ?>

This above is as much I get from google for how to create sql in step-by-step. I just created a simple PHP questionnaire and get results submit to email. Now, I like to learn how to do SQL or Database (what is this called?) that I can use a PHP webpage with questions, and then upon submit, the data get INSERT/APPEND to a DB. Then I can gather data from a hosting website, download the data and makeup a percentage from survery. I just want to know what to start with on a blank PHP page. Example:

<html xmlns="http://www.w3.org/1999/xhtml"><head>	<title>Hey</title>	<link rel="stylesheet" type="text/css" href="style.css" /></head><body><div id="header"><?php include("nav.php"); ?></div><br/>?? now what ??

Do I need to create a DB first (example: food.db) then add that food.db to DB directory (like image directory for web pictures)? Where to start, what must have first, those are what I need to know. Step-by-step. I used to program in SQL many years ago (so I am somewhat rusty with it), I am asking just how the web database work. I have Win7, IIS7, VS 2008, and SQL Sever 2005. Is having the SQL Server just for localhost to work? The web hosting has PHP v5 and MySQL v5. I never worked with web's "cPanel", do I need to do that? If there a step-by-step (from scratch) website that I can follow (eHow website didn't help me), please let me know. Thank you. Chuck

Link to comment
Share on other sites

First of all if your development enviourment and production enviourment is same it will good. so if your production server is using mysql, it is best to install mysql in your development computer. Though ms server will also work fine. for mysql-php there is option for dlownloading package WAMP or XAMPP which will install apache php mysql. If you want to run on IIS you can also set up PHP and mysql manualy. once they are installed you can use mysql extension in your script. PHP has several API/abstraction layers which can communicate with mysql/msql/oracle and other databases. There is seprarte API for each databse server for mysql there is mysqli. MYSQLi stands for mysql imroved. there is also extension as but it is used for older mysql database. so if you are starting it is best to start with mysqli. you can also use [http://php.net/PDO]PDO which work as abstraction layer and can handle numerous of database.

Link to comment
Share on other sites

First of all if your development enviourment and production enviourment is same it will good. so if your production server is using mysql, it is best to install mysql in your development computer.
So, the SQL Server 2005 is now junk? I can understand having same things for same things, sortof all eggs in same basket. Forgive me, but your reply isn't helping me. Sounds like my first step now is to throw away the SQL Server 2005? Chuck
Link to comment
Share on other sites

sorry for that..yes you can forget about sql server for now and can start with installing wamp if you have not already installed it

Link to comment
Share on other sites

I am still in school fulltime, so I am not responding to this as fast... anyway. The localhost shows the IIS7 welcome screen (with languages around it), as it's always been. Installing the EasyPHP WAMP didn't do anything to the localhost. Unless you want to know what my PC is showing, so you can guide me correctly? So, with the EasyPHP WAMP installed (basically it's just a "running background" thing, not an application?), using PNP, what;s next? Chuck

Link to comment
Share on other sites

You'll need to do a custom installation if you want to run 2 web servers, normally they both try to listen on the same ports. Otherwise, install PHP and MySQL manually on IIS using the instructions in the PHP manual, or remove IIS and only use WAMP.

Link to comment
Share on other sites

I open IIS Manager and 'Stop' it.Typed "localhost", nothing (so the IIS is really stopped?)Typed "127.0.0.1", the IIS welcome screen comes on. Do I really need to UNinstall the IIS? or just uncheck it in that "Turn Windows features on or off" ? I don't have MySQL. It is my understanding (from this thread) that the EasyPHP WAMP is the same thing as MySQL? Can someone explain to me what was the reason(s) for the steps I am doing here so far? Seems the IIS is not good with MySQL? Once again, I just want to learn how to do a DB with web so I can do a survey (or a poll). I have the questionnaire ready (still need more touch ups), but I don't want to do it through emails, writing/typing the polls counts, memos, etc. A database is made for that purpose. I was a SQL DB programmer many years ago, so it's not the DB I need to learn, I need to learn how the WEB integration DB. It's just the free host server I am using has MySQL. Is that common? I just have the (full version) VS 2008 and SQL Server 2005 software. Chuck

Link to comment
Share on other sites

Typed "127.0.0.1", the IIS welcome screen comes on.
That means it's still running.
Do I really need to UNinstall the IIS? or just uncheck it in that "Turn Windows features on or off" ?
I think it's sufficient to turn it off, but I'm not sure. I just installed PHP on IIS, so I still have IIS running.
I don't have MySQL. It is my understanding (from this thread) that the EasyPHP WAMP is the same thing as MySQL?
They're not the same thing, WAMP is a package that includes the Apache web server, PHP, MySQL, and phpMyAdmin. If you already have IIS running and listening on port 80 then Apache won't be able to do the same.
Can someone explain to me what was the reason(s) for the steps I am doing here so far? Seems the IIS is not good with MySQL?
IIS is a full-featured, powerful server. You can manually install PHP to work with IIS, and manually install MySQL (MySQL does not interact directly with a web server like IIS or Apache). WAMP is supposed to be easier to use because it will install everything individually and configure them to work with each other as needed. If you want to install PHP manually and hook it up with IIS, start here: http://www.php.net/manual/en/install.php Follow the path to install PHP manually on IIS 7 with FastCGI. These are the downloads for PHP on Windows: http://windows.php.net/download/ For IIS 7 you would get the VC9 non-thread-safe version. There are similar instructions for installing MySQL: http://dev.mysql.com/downloads/installer/http://dev.mysql.com/doc/refman/5.1/en/installing.html
It's just the free host server I am using has MySQL. Is that common?
Yes.
Link to comment
Share on other sites

I think it's sufficient to turn it off, but I'm not sure. I just installed PHP on IIS, so I still have IIS running.
I will attempt to "uncheck" the IIS from the Windows Features, then try again.
IIS is a full-featured, powerful server. You can manually install PHP to work with IIS, and manually install MySQL (MySQL does not interact directly with a web server like IIS or Apache). WAMP is supposed to be easier to use because it will install everything individually and configure them to work with each other as needed. If you want to install PHP manually and hook it up with IIS, start here:
I already installed the PHP manually with IIS and both working good. It was a lot of work and thinking (and hours) to get this PHP manually installed. So, now I can just install MySQL !? oh, I forgot I dont have MySQL. Anyway, what you mean by "MySQL does not... like IIS"? It both just work like ODBC? Maybe I should look for MySQL... anyone got a free copy for me :) ?? Is there a official free copy of MySQL (like Oracle does for their programming)? Chuck
Link to comment
Share on other sites

I download the MySQL, installed everything (including SQL Server 5.5). I created a DB (self-create unique ID, name, address, etc). I like to start the webpage utilize the DB. I started with Workbench 5.2CE (Survey.mwb). What's next? I did search and appears that most use MySQL to DISPLAY data from DB to the Webpage. I want to COLLECT data from Webpage TO DB. So, I like to create a Webpage (PHP, right?) and ask for name, address, favorite color, etc. Then have a submit button, then maybe a "confirmation" page so the people see what they did and what will be submitted, then upon submit, it will APPEND to the DB (on the host server, which I don't know how that works either... yet). This is for a survey, not to order anything (no shopping cart). Chuck

Link to comment
Share on other sites

I am confused? I was just checking out the host's MySQL (called phpMyAdmin). It appears that the way it works is to create the DB on their website, instead of I create one at home with MySQL installed? Or is that how this one particular website (and others allow one to upload home-created DB to a host?)? Did I wasted my time with download/install MySQL on my laptop? I am just trying to understand... Chuck ADDED : As I was creating the DB (on their hosting site), the "Collation" is "latin1_swedish_ci" by default. There is a dropdown list of that, what do I pick for standard American English? Or it does not matter (what is it anyway?)?

Edited by CNT
Link to comment
Share on other sites

[quote name='CNT' timestamp='1332009283' post='234872']I am confused? I was just checking out the host's MySQL (called phpMyAdmin). It appears that the way it works is to create the DB on their website, instead of I create one at home with MySQL installed? Or is that how this one particular website (and others allow one to upload home-created DB to a host?)? Did I wasted my time with download/install MySQL on my laptop? I am just trying to understand... Chuck[/quote]phpmyadmin is not mysql database. it is a php application which let connect clients to their mysql server. when you will install a script or run a script you are goinf to use your host's phpmyadmin to manage your database. you still need to install mysql in your home server if you want to develop localy. mysql comes with a cmd which is not faster to use as phpmyadmin. so that you may like to download and install phpmyadmin for your home server too. you can export your database schema from it and can import it to your remote server.but before you do that you need to make sure your server is running and php is working fine. so first make a php script like[CODE]<?php phpinfo();?>[/CODE]place it in webroot then type http://localhost..what do you see?
Link to comment
Share on other sites

it must be a .php extension. eg what.php

Link to comment
Share on other sites

PHP Version 5.3.6 System Windows NT LENO-LAPTOP 6.1 build 7601 (Unknow Windows version Business Edition Service Pack 1) i586 Build Date Mar 17 2011 10:46:06 Compiler MSVC9 (Visual C++ 2008) Architecture x86 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet" "--with-mcrypt=static" Server API CGI/FastCGI Virtual Directory Support disabled Configuration File (php.ini) Path C:\Windows Loaded Configuration File C:\Program Files (x86)\PHP\v5.3\php.ini Scan this dir for additional .ini files (none) Additional .ini files parsed (none) PHP API 20090626 PHP Extension 20090626 Zend Extension 220090626 Zend Extension Build API220090626,NTS,VC9 PHP Extension Build API20090626,NTS,VC9 Debug Build no Thread Safety disabled Zend Memory Manager enabled Zend Multibyte Support disabled IPv6 Support enabled Registered PHP Streams php, file, glob, data, http, ftp, zip, compress.zlib, https, ftps, phar Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tls Registered Stream Filters convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.* This program makes use of the Zend Scripting Language Engine: Zend Engine v2.3.0, Copyright © 1998-2011 Zend Technologies
Link to comment
Share on other sites

your php and web server is running ok.can you see mysql diretive there down to the page?

Link to comment
Share on other sites

 HTTP Error 404.3 - Not FoundThe page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Detailed Error InformationModuleStaticFileModule NotificationExecuteRequestHandlerHandlerStaticFile Error Code0x80070032 Requested URLhttp://localhost:80/what.phpPhysical PathC:\inetpub\wwwroot\what.php Logon MethodAnonymousLogon UserAnonymous

I just tried the what.php to read some more (you mention to locate the mysql diretive), now I am getting this error message. I can go on the internet though. You know what... why don't I clean install my laptop with Win7 Pro. Then install only what's needed (meaning won't be installing VS2008 nor SQL Server 2005). I think the problem is I am installing a mix of servers (EasyPHP, SQL Server, WAMP, etc... and the IIS7 is still running). So, for a clean install, what do I install (and in the order thereof)? Win7 ProALL Windows Updates (including latest IE broswer)MS Office 2007 (and more Windows Updates too)a PDF readerProgrammer's Notepadthen what... ? adjust IIS7? Install what? Thank you. Chuck

Link to comment
Share on other sites

I think the problem is I am installing a mix of servers (EasyPHP, SQL Server, WAMP, etc... and the IIS7 is still running).
wamp is package which includes apache webserver. probably Easyphp is also a package with apache webserver. sql server runing should nott have problem. they do listen to different ports. I have oracle,mysql,sqlserver runing on same machine. you cant have two webserver running on same machine. you need to choose IIS or apache. webserver do listen to same port thus that conflict occuring. i thought you are going to use iis and from your replies it seems that iis and php was runing well. i dont know what happend there after.first decide you want to run in iis or apacheif its apache you can use wamp (or easyphp like package) which will install all the things. it is the most easiest wayif it is iis then it would be same as we wrote earlier in previous posts
  • Like 1
Link to comment
Share on other sites

So... upon install Win7 Pro (64 bit), it will default IIS7 to run as a webserver? Correct me... the default IIS7 will be in fully functional? I am asking because some time ago, I had to adjust the IIS7 to make something work (I think it was the SQL Server related) and I forgot what was that procedure. Yes, I like to use IIS7 (since it's already buildin Win7). So, with IIS, I will have to download the: http://windows.php.net/download/ (and choose the "VC9 x86 Non Thread Safe")and follow this:http://www.php.net/manual/en/install.windows.iis7.phpThis is where I spend a lot of time trying to understand and modifiy those steps.Correct me... I stop right after Example #3. Now, do I still have to install MySQL (http://dev.mysql.com/downloads/installer/) ? Correct me... by installing MySQL on my laptop would enable me to run my web pages from my laptop (test). If and after I install MySQL on my laptop, would I be able to transfer my DB table(s) to the hosting server? Lastly, to read my results, I open MySQL from my laptop and using MySQL to login to the web host and read/download the data? Thank you. Chuck

  • Like 1
Link to comment
Share on other sites

If you choose the options to install and set up IIS then Windows should configure it and the firewall so that it responds to requests. Then you install PHP, then MySQL, and you should probably install phpMyAdmin also. I wouldn't stop after example 3 on the PHP installation steps, read the rest and see if you want to apply the various changes to FastCGI.

Correct me... by installing MySQL on my laptop would enable me to run my web pages from my laptop (test).
Installing MySQL allows PHP pages which connect to MySQL (or anything else that looks for it) to work. You don't need MySQL to run PHP code that doesn't use it.
If and after I install MySQL on my laptop, would I be able to transfer my DB table(s) to the hosting server?
You can use the version of phpMyAdmin that is installed on your computer to export your database, and use phpMyAdmin on the host server to import it.
Lastly, to read my results, I open MySQL from my laptop and using MySQL to login to the web host and read/download the data?
It will be easier to use phpMyAdmin to manage the database and review the data.
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...