>From manual page on mysql_db_query():

Note: This function has been deprecated since PHP 4.0.6. Do not use this
function. Use mysql_select_db() and mysql_query() instead. 

---John Holmes...

> -----Original Message-----
> From: Jason Morehouse [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 22, 2002 8:59 PM
> To: [EMAIL PROTECTED]; Brandon Boyce
> Subject: [PHP-DB] Re: Insert Newbie
> 
> $result = mysql_db_query($db,"$SQL",$cid) or die (mysql_error());
> 
> ...should give you and idea.
> 
> On Sun, 22 Sep 2002 12:05:19 +0000, Brandon Boyce wrote:
> 
> > Below is the code I used to try to insert info into a mysql
database,
> the
> > form posts to itself. After I hit the submit button it isn't echoing
the
> > indication that information has been added, and when I check the
> database
> > there isn't anything there. help please!
> >
> > <?
> >     $usr = "username";
> >     $pwd = "password";
> >     $db = "dbname";
> >     $host = "localhost";
> >
> >     # connect to database
> >     $cid = mysql_connect($host,$usr,$pwd);
> >     if (!$cid) { echo("ERROR: " . mysql_error() . "\n");    }
> >
> > ?>
> > <HTML>
> > <HEAD>
> >    <TITLE>Insert Link</TITLE>
> >
> > </HEAD>
> > <BODY BGCOLOR="#FFFFFF">
> >
> > <P><FONT SIZE=5><B> Add Link </B> </FONT></P>
> >
> > <?
> >     if ($REQUEST_METHOD=="POST") {
> >
> >
> >         $description = str_replace("'","''",$description);
> >         $sitename = str_replace("'","''",$sitename);
> >
> >
> >         $SQL = " INSERT INTO links ";
> >         $SQL = $SQL . " (category, sitename, siteurl, description)
> VALUES ";
> >         $SQL = $SQL . " ('$category',
> '$sitename','$siteurl','$description')
> > ";
> >
> >
> >         $result = mysql_db_query($db,"$SQL",$cid);
> >
> >              if (!$result) { echo("ERROR: " . mysql_error() .
> > $SQL\n");    }
> >
> >         echo ("<P><B>New Link Added</B></P>\n");
> >
> >     }
> >
> > ?>
> >
> > <FORM NAME="fa" ACTION="insert.php" METHOD="POST">
> > <TABLE>
> > <TR><TD><B>Category: </B> </TD><TD><INPUT TYPE="text"
NAME="category"
> > SIZE=40></TD></TR>
> > <TR><TD><B>Site Name:</B> </TD><TD><INPUT TYPE="text"
NAME="sitename"
> > SIZE=40></TD></TR>
> > <TR><TD><B>Site URL: </B> </TD><TD><INPUT TYPE="text" NAME="siteurl"
> > VALUE="http://"; SIZE=40></TD></TR>
> > <TR><TD VALIGN=TOP><B>Description: </B> </TD><TD> <TEXTAREA
> > NAME="description" ROWS=5 COLS=40></TEXTAREA></TD></TR>
> > <TR><TH COLSPAN=2><P><INPUT TYPE="submit" VALUE="Add
> Link"></P></TH></TR>
> > </TABLE>
> > </FORM>
> >
> >
> > <?    mysql_close($cid); ?>
> > </BODY>
> > </HTML>
> 
> --
>  Jason Morehouse (jm[@]netconcepts[.]com)
>  Netconcepts - http://www.netconcepts.com
>  Auckland, New Zealand
>  Linux: Because rebooting is for adding hardware.
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to