View Full Version : sql and php connection help
furley
December 12th, 2006, 02:26 PM
i am very lost.
i have a one table database and i need to just list the content from that db on a php web page. i made the table in excel and a friend of mine converted that in sqk server to a .MDF file. I dont really know where to go from here. i have uploaded the mdf to my server and i know i need to write some php code to connect to it. i know the basics of some of this but can anyone help me out or guide me in some way.
-furley
SlowRoasted
December 12th, 2006, 02:35 PM
if that is an access database (.mdb) you will have to set up an odbc connection on your server and use the odbc functions in php to connect and display the contents.
bwh2
December 12th, 2006, 02:36 PM
no, it's a SQL Server Master DB file.
furley
December 12th, 2006, 02:36 PM
its an .mdf file which i believe is the data file of an sql db
bwh2
December 12th, 2006, 02:47 PM
the first question is this - does your host support MS SQL Server? note: that's not the same as MySQL. if your host doesn't support MS SQL Server, that .mdf file doesn't do you much good. if you are going to use MySQL instead, you are better off just trying to import the excel file.
furley
December 12th, 2006, 03:08 PM
oh great. i don't actually have access. [of course not] the site does support mysql but i only have ftp access. i dont know how to import the excel file without remote access or something. any ideas.
[thanks for the help by the way]
bwh2
December 12th, 2006, 03:13 PM
this has nothing to do with Access. how many records does your table have?
furley
December 12th, 2006, 03:20 PM
about 300
bwh2
December 12th, 2006, 03:32 PM
how many columns? and is this something you will need to modify?
furley
December 12th, 2006, 03:35 PM
4 columns
and im gonna need to insert and delete records.
bwh2
December 12th, 2006, 03:36 PM
yeah, a db is your best option. it's possible to use XML or flat file, but not ideal. but if all you have is FTP access, those might be your best bets.
furley
December 12th, 2006, 03:43 PM
hmm... sounds interesting. do you any place where i could find info on how to do that [other than just googling it]
bwh2
December 12th, 2006, 03:50 PM
http://www.kirupa.com/developer/php/filehandling.htm
http://www.kirupa.com/developer/php/php5_simpleXML.htm
furley
December 12th, 2006, 04:05 PM
how would i be able to update the xml file. i need to insert and delete records.
like would i have to do it manually or is there a way to make a web form tht will do it?
bwh2
December 12th, 2006, 04:11 PM
you would use a form to determine which records not to keep (or which to update), then you would rewrite the whole file. like i said, it's not ideal.
furley
December 12th, 2006, 04:14 PM
fair enough. thanks so much for all the help
bwh2
December 12th, 2006, 04:51 PM
no problem. good luck.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.