PHP/MySQL doesn't work
Posted by: firedrow (216.106.24.---)
Date: October 25, 2006 08:39PM

The MySQL/PHP flat db files I have built on my laptop (Ubuntu 6.06, Apache 1.3, PHP5, MySQL) work great, but as soon as I move them to a Windows 2003 Server running WAMP5 they don't work. I made the database and user with all privileges, made sure the paths matched on my laptop and the Win2k3 in the files, but they don't seem to connect to the db or they aren't rendering.

One of the forms displays, but the date line has the echo php date function instead of the current date. The other pages just don't display.

Options: ReplyQuote
Re: PHP/MySQL doesn't work
Posted by: CyberSpatium (71.237.217.---)
Date: October 25, 2006 10:07PM

sometimes in your php scripts you need to use windows paths like this:

c:\\someplace\\somedirectory

Options: ReplyQuote
Re: PHP/MySQL doesn't work
Posted by: firedrow (216.106.24.---)
Date: October 25, 2006 10:24PM

all the paths are relative. I made a sqltest.php to test the connection to the server and the database, I got Successful on both so I know it is connecting. Here is the code for my add.php (adds the request to the db)

<?

if($_POST['submit'])
{
mysql_connect("localhost","itwork","itwork"winking smiley;
mysql_select_db("itwork"winking smiley;

$name = $_POST['name'];
$date = $_POST['date'];
$location = $_POST['location'];
$problem = $_POST['problem'];

$result=MYSQL_QUERY("INSERT INTO request (id,name,date,location,problem)".
"VALUES ('NULL', '$name', '$date', '$location', '$problem')"winking smiley;

echo "Request Made!<br>";
echo "<a href='../index.php'>Back to Intranet</a>";
}
else
{
?>
<form method="post" action="add.php">
<TABLE>
<TR>
<TD>Name:</TD>
<TD><INPUT TYPE='TEXT' NAME='name' VALUE='' size=20></TD>
</TR>
<TR>
<TD>Location:</TD>
<TD>
<SELECT NAME='location'>
<OPTION VALUE='reception'>Reception Area
<OPTION VALUE='tech'>Technician Area
<OPTION VALUE='reading'>Reading Room
<OPTION VALUE='office'>Office
</SELECT>
</TD>
</TR>
<TR>
<TD>Date:</TD>
<TD>
<INPUT TYPE='TEXT' NAME='date' VALUE='<? echo date("Y-m-d"winking smiley; ?>' size=10>
</TD>
</TR>
<TR>
<TD valign="top">Problem:</TD>
<TD><TEXTAREA COLS='60' ROWS='8' NAME='problem'></TEXTAREA></TD>
</TR><br>
<TR>
<TD></TD><br>
<TD><INPUT TYPE="submit" name="submit" value="submit"></TD>
</TR>
</TABLE>
</form>

<?
}
?>

Options: ReplyQuote
Re: PHP/MySQL doesn't work
Posted by: CyberSpatium (71.237.217.---)
Date: October 26, 2006 04:57PM

ok, here is your problem, you are usign short ASP stype tags (<?) you need to use full php tags (<?php).

change the first line of your script from:

<?

to

<?php

Options: ReplyQuote


Sorry, only registered users may post in this forum.