tier1rep Posted October 18, 2012 Share Posted October 18, 2012 I have been asked to host a website on my server which is no problem. The site loads just fine but the issue im having is getting the php to link to the mysql database. im not that versed in PHP other then to make the updates in it to link to my mysql which is where im still having the problem. i have the info in right but it still wont connect. i made a test php to test access to the mysql and it is working fine. if someone would mind taking a look at these webfiles and give me some input i would appreciate it. listed below will be all the info. thanks Server info: Windows server 2008 sp1 webserver IIS7 PHP 5 mysql 5.5 PHPmyadmin 3.5.3 website name: http://millercomputerrepair.com I made a test php to make sure the database was allowing access, here is the test address. it did pull data from the database and table. below is the test php http://millercomputerrepair.com/test1.php Please Help me!! Website Files -------->>> http://millercomputerrepair.com/Miller.zip Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/ Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 You link a database to php through a php connection script. Ex: <?php //Define connection settings $host = "localhost"; $user = "root"; $pass = ""; $database = "database name"; //Connect $con = mysql_connect($host, $user, $pass) or die("Could not connect."); //Select the database your website gets its content from $db = mysql_select_db($database) or die("Could not select database."); ?> Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385968 Share on other sites More sharing options...
tier1rep Posted October 18, 2012 Author Share Posted October 18, 2012 thanks for the response but i didnt build the pages, im just trying to make them work... there is coding just like that already on the page.. but what im saying is i dont understand why it still doest work.. did you take a look at the zipfile i posted. i have updated the host, user, pass, databasename already but it still wont connect. im not sure if something else is wrong. dream weaver finds not syntax errors which is why im lost... I have listed a zip file with the website in it if you care to look at the actual site and code. thanks Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385970 Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 (edited) Maybe see if you spelt the connection settings correctly? Edited October 18, 2012 by White_Lily Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385971 Share on other sites More sharing options...
tier1rep Posted October 18, 2012 Author Share Posted October 18, 2012 this is the coding on the index page <? //MySQL Variables $db_host = "localhost"; $db_user = "pmiller"; $db_name = "murrayju_miller"; $db_pass = "admin191"; $connect = mysql_connect("$db_host","$db_user","$db_pass"); $select_db = mysql_select_db("$db_name"); $q = mysql_query("INSERT INTO `fields` ( `id` , `name` , `content` ) VALUES (NULL , 'setup', 'mer');", $connect); $q = mysql_query("INSERT INTO `fields` ( `id` , `name` , `content` ) VALUES (NULL , 'upgrades', 'mer');", $connect); $q = mysql_query("INSERT INTO `fields` ( `id` , `name` , `content` ) VALUES (NULL , 'dataretrieval', 'mer');", $connect); $q = mysql_query("INSERT INTO `fields` ( `id` , `name` , `content` ) VALUES (NULL , 'virus', 'mer');", $connect); ?> and there is similar cable on all other pages Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385980 Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 (edited) Whats with all the inserts? O.o Have you also tried using a php.ini file? If not - create one and type into it: display_errors = on error_reporting = -1 Save that file as "php.ini" and run your web page again. (NOTE: you may need to re-start your web server) Edited October 18, 2012 by White_Lily Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385982 Share on other sites More sharing options...
Jessica Posted October 18, 2012 Share Posted October 18, 2012 Go change the password for that account now. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385983 Share on other sites More sharing options...
TOA Posted October 18, 2012 Share Posted October 18, 2012 A.Don't post personal credentials on a forum. Go change the password for that account now. B. Are you sure the user/database/table exists? C. Try taking the quotes out from around the variables. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385984 Share on other sites More sharing options...
TOA Posted October 18, 2012 Share Posted October 18, 2012 Whats with all the inserts? O.o Have you also tried using a php.ini file? If not - create one and type into it: display_errors = on error_reporting = -1 Save that file as "php.ini" and run your web page again. (NOTE: you may need to re-start your web server) Or you can just add ini_set('display_errors', 1); error_reporting(E_ALL); to the top of your script Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385985 Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 As i found out the other day its better to use "-1" not E_ALL and if he uses php.ini it will show errors across his entire site, not just one page. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385986 Share on other sites More sharing options...
TOA Posted October 18, 2012 Share Posted October 18, 2012 (edited) As i found out the other day its better to use "-1" not E_ALL So change it to -1 then, it's much easier then restarting a web server if he uses php.ini it will show errors across his entire site, not just one page. It sounds like he's in a live environment so that's not a good thing. Just one man's opinion. Edited October 18, 2012 by TOA Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385988 Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 If he uses the php.ini it means he can sort out as many errors in his whole site as he possibly can rather having to insert code at the top of each page to find the errors. Therefore its actually easier just to restart the web server since it only takes 20 seconds Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385989 Share on other sites More sharing options...
Jessica Posted October 18, 2012 Share Posted October 18, 2012 As i found out the other day its better to use "-1" not E_ALL and if he uses php.ini it will show errors across his entire site, not just one page. If you're using 5.4+ you use E_ALL. It's not "better" to use one over the other, the -1 is for <5.4 when E_STRICT was not included in E_ALL. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385990 Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 (edited) The -1 will show all possible error, whereas E_ALL will suppress E_DEPRECATED and few others. Using -1 lets a developer correct as much as possible, and helps make sure the code isn't going to suddenly stop working when the server is upgraded to the next version of php. So actually it is more useful to use -1. Edited October 18, 2012 by White_Lily Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385991 Share on other sites More sharing options...
Jessica Posted October 18, 2012 Share Posted October 18, 2012 Where did you get the idea that E_ALL does not include E_DEPRECATED? As I said, before 5.4 E_ALL did not include E_STRICT - that's it. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385993 Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 I'm just saying what I have been told. So far I have you telling me I am supposed to be using E_ALL and a Mod telling me to use -1 Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385995 Share on other sites More sharing options...
Jessica Posted October 18, 2012 Share Posted October 18, 2012 Did you actually read what I wrote? Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385997 Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 Im only passing on what I been told by others no need to have a go at me. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1385998 Share on other sites More sharing options...
Jessica Posted October 18, 2012 Share Posted October 18, 2012 So the PM you sent out I'm guessing en masse, you forgot that already? No one is "having a go" at you. Grow up. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1386001 Share on other sites More sharing options...
White_Lily Posted October 18, 2012 Share Posted October 18, 2012 I am only posting what I have been told from others. and yes i read what you wrote. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1386006 Share on other sites More sharing options...
Pikachu2000 Posted October 18, 2012 Share Posted October 18, 2012 Yes, it's true that in PHP 5.4+ E_ALL and -1 are the same. In all previous versions however, they are not, and -1 is the value needed to get 100% of the errors reported. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1386022 Share on other sites More sharing options...
tier1rep Posted October 19, 2012 Author Share Posted October 19, 2012 ok i appreciate all the responses. sorry it got off track there but i think my issue is a problem that might be hard coded into that Flash SWF file which i will not be able to corrct so i will think i will just build new site. but one question i have that i cant seem to find an answer to ... is it possible build a page in HTML , ID certain tables around the page and have them call data form fields in the table? everything i see is echo'ing or printing the data in a table on the page but not where i need the table to show like next to an imaga or so.. is it possible to set the cell or table as a placeholder to auto call data from the connected database? hope i explained that right. thanks Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1386416 Share on other sites More sharing options...
jcbones Posted October 20, 2012 Share Posted October 20, 2012 PHP is stateless, and is run on the server. After a client (browser) calls the server, it translates the PHP, and sends results to the browser. PHP is then finished with it's project, and forgets everything it just did. There is no constant "connection" between the client and the server. In order to update a "cell" in a table on-click or otherwise, you will have to use a client side scripting language (javascript) to call the server, and ask for the data. This method is called Asynchronous Javascript (AJAX). You will need to know a little bit of PHP, Javascript, and HTML in order to get it to work correctly. More specifically: How to use PHP's $_GET array. How to make a HTTP request with Javascript How to receive a HTTP request with Javascript How to take the results, and put them into the HTML table There are libraries like Jquery, which make AJAX a little easier. Although, I even find their manual a little bit confusing. I hope this answered your last question. Quote Link to comment https://forums.phpfreaks.com/topic/269624-website-help/#findComment-1386508 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.