Newbi
From: mickey (meshulamtemp_at_yahoo.com)
Date: 07/29/04
- Next message: Ilya Knizhnik: "PHP with sybase or postgresql"
- Previous message: Kev T: "Help with a PHP5 problem"
- Next in thread: Justin Koivisto: "Re: Newbi"
- Reply: Justin Koivisto: "Re: Newbi"
- Reply: Matthias Esken: "Re: Newbi"
- Reply: Andy Hassall: "Re: Newbi"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Jul 2004 21:03:32 GMT
I am getting the following error at the line
mysql_free_result($result);
Warning: Supplied argument is not a valid MySQL result resource in
/var/www/html/php/phoneadd.php on line 27
My code is as follows:
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "", "")
or die("Could not connect : " . mysql_error());
mysql_select_db("test",$db);
$sql = "INSERT INTO phone (fname,lname,street,h_phone) VALUES
('$fname','$lname','$street','$h_phone')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($db);
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<table>
<tr>
<td>First name: </td><td><input type="Text" name="fname"></td>
</tr>
<tr>
<td>Last name: </td><td> <input type="Text" name="lname"></td>
</tr>
<tr>
<td>Address: </td><td><input type="Text" name="street"></td>
</tr>
<tr>
<td>Home Phone:</td><td> <input type="Text" name="h_phone"></td>
</tr>
<tr>
<td></td><td> <input type="Submit" name="submit" value="Enter information">
</td>
</tr>
</table>
</form>
<?php
} // end if
?>
</body>
</html>
- Next message: Ilya Knizhnik: "PHP with sybase or postgresql"
- Previous message: Kev T: "Help with a PHP5 problem"
- Next in thread: Justin Koivisto: "Re: Newbi"
- Reply: Justin Koivisto: "Re: Newbi"
- Reply: Matthias Esken: "Re: Newbi"
- Reply: Andy Hassall: "Re: Newbi"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|