help I'm desperate!!
Posted: Wed Nov 19, 2003 6:21 pm
I'm trying to use basic PHP functions,
but can't even work with this simple tutorial,
why isn't working? , at the same time I'm running phpdevadmin
and work fine with the database, so apache, php and mysql
are running ok... what's wrong??
---------------------------------------------
<html><head><title>PHP_test</title>
</head>
<body>
<?php
$dbcnx = @mysql_connect("localhost");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" ); exit(); }
if (! @mysql_select_db("jokes") ) {
echo( "<P>Unable to locate the joke " .
"database at this time.</P>" ); exit(); }
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Type your joke here:<BR><TEXTAREA NAME="joketext"
ROWS=10 COLS=40 WRAP></TEXTAREA>
<BR><INPUT TYPE=SUBMIT NAME="submitjoke" VALUE="SUBMIT">
</FORM>
<?php
if ("SUBMIT" == $submitjoke) {
$sql = "UPDATE Jokes SET " .
"JokeDate=CURDATE()";
"JokeText='$joketext', " .
if (mysql_query($sql)) {
echo("<P>Your joke has been added.</P>");
} else {
echo("<P>Error adding submitted joke: " .
mysql_error() . "</P>"); }
}
?>
</body>
</html>
but can't even work with this simple tutorial,
why isn't working? , at the same time I'm running phpdevadmin
and work fine with the database, so apache, php and mysql
are running ok... what's wrong??
---------------------------------------------
<html><head><title>PHP_test</title>
</head>
<body>
<?php
$dbcnx = @mysql_connect("localhost");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" ); exit(); }
if (! @mysql_select_db("jokes") ) {
echo( "<P>Unable to locate the joke " .
"database at this time.</P>" ); exit(); }
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Type your joke here:<BR><TEXTAREA NAME="joketext"
ROWS=10 COLS=40 WRAP></TEXTAREA>
<BR><INPUT TYPE=SUBMIT NAME="submitjoke" VALUE="SUBMIT">
</FORM>
<?php
if ("SUBMIT" == $submitjoke) {
$sql = "UPDATE Jokes SET " .
"JokeDate=CURDATE()";
"JokeText='$joketext', " .
if (mysql_query($sql)) {
echo("<P>Your joke has been added.</P>");
} else {
echo("<P>Error adding submitted joke: " .
mysql_error() . "</P>"); }
}
?>
</body>
</html>