RE: [PHP-DB] Re: Insert Newbie

2002-09-22 Thread John Holmes

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 +, 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
 TITLEInsert Link/TITLE
 
  /HEAD
  BODY BGCOLOR=#FF
 
  PFONT SIZE=5B 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 (PBNew Link Added/B/P\n);
 
  }
 
  ?
 
  FORM NAME=fa ACTION=insert.php METHOD=POST
  TABLE
  TRTDBCategory: /B /TDTDINPUT TYPE=text
NAME=category
  SIZE=40/TD/TR
  TRTDBSite Name:/B /TDTDINPUT TYPE=text
NAME=sitename
  SIZE=40/TD/TR
  TRTDBSite URL: /B /TDTDINPUT TYPE=text NAME=siteurl
  VALUE=http://; SIZE=40/TD/TR
  TRTD VALIGN=TOPBDescription: /B /TDTD TEXTAREA
  NAME=description ROWS=5 COLS=40/TEXTAREA/TD/TR
  TRTH COLSPAN=2PINPUT 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




RE: [PHP-DB] Re: Insert Newbie

2002-09-22 Thread Jason Morehouse

Yeah, that too =)

On Sun, 22 Sep 2002 22:02:31 +, John Holmes wrote:

 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 +, 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
 TITLEInsert Link/TITLE
 
  /HEAD
  BODY BGCOLOR=#FF
 
  PFONT SIZE=5B 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 (PBNew Link Added/B/P\n);
 
  }
 
  ?
 
  FORM NAME=fa ACTION=insert.php METHOD=POST
  TABLE
  TRTDBCategory: /B /TDTDINPUT TYPE=text
 NAME=category
  SIZE=40/TD/TR
  TRTDBSite Name:/B /TDTDINPUT TYPE=text
 NAME=sitename
  SIZE=40/TD/TR
  TRTDBSite URL: /B /TDTDINPUT TYPE=text NAME=siteurl
  VALUE=http://; SIZE=40/TD/TR
  TRTD VALIGN=TOPBDescription: /B /TDTD TEXTAREA
  NAME=description ROWS=5 COLS=40/TEXTAREA/TD/TR
  TRTH COLSPAN=2PINPUT 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

-- 
 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