PDA

View Full Version : Putting database files onto server


heirani1
06-05-2008, 12:26 AM
well i have been working through the tutorials online about php, the one where you use wamp and a database and connect them etc.

Well my question is i have done the tutorial but if i wanted to put the files onto a server how would i get the database onto the server if you know what i mean?

Thanks fot your help,

Chris

davidj
06-05-2008, 06:37 AM
you would export your database and then import it into your new db

not sure if you have an export function available from EMS. Most IDE's do have this feature. You need to create the db on your live machine and then in the console (HELM or whatever) should have an import option

heirani1
06-05-2008, 02:29 PM
EMS has to export functions, one is a export data wizard the other is a export as SQL Script, do you know which one i would need to put it onto a host?

domedia
06-05-2008, 02:52 PM
EMS has to export functions, one is a export data wizard the other is a export as SQL Script, do you know which one i would need to put it onto a host? I've used both, but you have to ask your host what will work.

davidj
06-05-2008, 03:53 PM
a SQL script is a text file which carries the correct syntax for import

it will include DROP, UPDATE and INSERT's as per standard SQL

you can save this off and it should import into your LIVE machine

heirani1
06-05-2008, 09:29 PM
ok thanks for clearing that up for me, apprecaite your help :lol:

heirani1
06-08-2008, 12:48 PM
i just got round to testing this on ther live computer, when i run login.php i can enter the username and password but then it comes up with this ...

Warning: Cannot modify header information - headers already sent by (output started at /www/99k.org/c/h/r/chrisheirani/htdocs/connection/connection.php:11) in /www/99k.org/c/h/r/chrisheirani/htdocs/login.php on line 21

what does this error message mean? and how can i fix it?

the login.php code is here ...

<?php
require_once("connection/connection.php"); //database connection
// catch field data
$userid = $_POST['userid'];
$password = $_POST['password'];
$submitted = $_POST['submitted'];
// if data is entered into these 2 fields then process code in {}
if ($userid && $password) {
///////////////////////////////////////////////////////////////
$query = sprintf("SELECT * FROM users where user_name='$userid' and user_password='$password'");
$result = @mysql_query ($query);
$rowAccount = @mysql_fetch_array($result);
///////////////////////////////////////////////////////////////
}
if ($rowAccount) {
$_SESSION ['id'] = $rowAccount['user_id'];
header("location:welcome.php");
exit;
}elseif ($submitted) {
echo "you dont exist in the system you cannot enter";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<table width="270" height="111" border="1" align="center">
<tr>
<td width="86">User ID</td>
<td width="168"><label>
<input type="text" name="userid" id="userid" />
</label></td>
</tr>
<tr>
<td>Password</td>
<td><label>
<input type="text" name="password" id="password" />
</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><label>
<input name="submitted" type="hidden" id="submitted" value="1" />
<input type="submit" name="Submit" id="button" value="Submit" />
</label></td>
</tr>
</table>
</form>
</body>
</html>

davidj
06-08-2008, 05:22 PM
you have an echo which is outputting data befor the headers are sent

you need to asign all messages in a variable which you echo in your html

heirani1
06-08-2008, 11:40 PM
so how would i do that?
I followed the VT that you done, unless i made a mistake somewhere, thanks again for your help

davidj
06-08-2008, 11:56 PM
whereyou have this...


echo "you dont exist in the system you cannot enter";



needs to be


$message = "you dont exist in the system you cannot enter";



then echo $message in the html where you want the message to appear

heirani1
06-09-2008, 12:54 PM
ok thanks that did the trick but now i'm getting a error saying ...
Warning: Cannot modify header information - headers already sent by (output started at /www/99k.org/c/h/r/chrisheirani/htdocs/connection/connection.php:11) in /www/99k.org/c/h/r/chrisheirani/htdocs/login.php on line 21

line 21 is ... header("location:welcome.php");

any help there? also why does this all work fine on the wamp server but when i put it live i get errors?

davidj
06-09-2008, 01:18 PM
you will have echos in the PHP above the HTML in the welcome.php page

the reason its works on your local machine as opposed to your live machine is that PHP is configured differently on your live machine

remember to assign all output strings to variables and use the variables inside the HTML to display

heirani1
06-09-2008, 01:36 PM
ok thanks david your a top man, thanks for help you have gave me.

cheers, chris