so i have the code below, for some reason the require_once(‘connect.php’); works but the require_once(‘config.php’); doesn’t work. i then tried moving the code fomr config to connect.php but that also didn’t work. i feel like it because of define(“name”,“value”); is messing it up. any ideas?
btw mysql_connect(“dbname”,“user”,“pass”) works if i type it in directly.
and the file manager for interworx is really bad. What do you guys use? for php/htm editing
<html>
<style type="text/css">
.fieldset-auto-width {
display: inline-block;
}
</style>
<?php
echo "support php?";
?>
<h2>Welcome!</h2>
<p>
This page is used to test the proper operation of
the new FreeHostingCloud account setup for studymob.freehostingcloud.com. If you
see this page then it works!
</p>
<form id='register' action='test.php' method='GET'
accept-charset='UTF-8'>
<fieldset class="fieldset-auto-width";>
<legend>Register</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<label for='name' >Your Full Name*: </label> </br>
<input type='text' name='name' id='name' maxlength="50" /> </br>
<label for='email' >Email Address*:</label> </br>
<input type='text' name='email' id='email' maxlength="50" /> </br>
<label for='username' >UserName*:</label> </br>
<input type='text' name='username' id='username' maxlength="50" /> </br>
<label for='password' >Password*:</label> </br>
<input type='password' name='password' id='password' maxlength="50" /> </br>
<input type='submit' name='Submit' value='Submit' /> </br>
</fieldset>
</form>
<?php
echo "test
";
require_once('connect.php');
echo "test2
";
if($_GET['submitted'] == 1){
$name = $_GET['name'];
echo $name;
}
echo "geez";
?>
</html>
connect.php file:
<?php
// Connecting to database
echo "in connect";
require_once("config.php");
echo "didnt work?";
// connecting to mysql
$result = mysql_connect(DB_NAME,DB_USER, DB_PASS);
if (!$result) {
echo "Can't connect to MySQL DB";
}
echo "Connected successfully to MySQL";
// selecting database
$selected = mysql_select_db("studymob_dbTest");
if(!$selected)
echo "Can't Select Database";
echo "Connected Successfully to database";
// return database handler
// Closing database connection
mysql_close();
?>
<?php
/**
* Database config variables
*/
echo "in config";
define('DB_HOST', '10.10.10.3');
define('DB_USER', 'dbuser');
define('DB_PASSWORD' 'xxx');
define('DB_DATABASE', 'dbname');
?>