Re: Can't INSERT in MySQL!!!

From: Date: Sat, 19 Aug 2000 07:49:46 +0000
Subject: Re: Can't INSERT in MySQL!!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12573@lists.php.net to get a copy of this message
Don't forget to select your database: This is the normal flow... mysql_connect('server','username','password'); mysql_select_db('database_name'); Then you can do queries... -jeremy brand _______________________________________________________________________ GnuPG Fingerprint: 9F5E 95E0 1CC2 E054 84EA 6099 8ACD 9DBA D2C0 5EA9 _ http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more __ > I have been messing with this for hours!! I have tried everything I can > think of and it is NOT inserting. It connects, the query looks good to me > (if I put it in on a command line it works). What am I doing wrong?? Here is > the links to the actual (semi-working) pages. > http://128.121.255.26/new_pcd/index2.php - This page is where > the end result > shows up. Under In The News > http://128.121.255.26/new_pcd/company/admin/inthenews_add.php - > This is > script I am having problems with. > > > Thanks for any and all help, > Jess > > Here is the code (plz excuse the debug stuff): > > <html> > <head> > <title>News Article Add</title> > </head> > <body> > <form method="get" action="inthenews_add.php" > encryption="multipart/formdata"> > > <? > if($Headline) { > > print("Headline is $Headline<br>"); > print("URL is $URL<br>"); > > print("Connecting...<br>"); > $connection = mysql_connect("localhost", "root", ""); > print("Connected to $connection<br>"); > > print("Setting Query...<br>"); > > $query = "INSERT INTO InTheNews (Headline,URL) VALUES ('$Headline', > '$URL') > "; > > print("Query Set To: $query <br>"); > > print("Querying...<br>"); > $result = mysql_query($query, $connection); > > print("Result $result<br>"); > > print("Counting rows that were changed...<br>"); > $affected = mysql_affected_rows($connection); > > print("$affected rows were changed...<br>"); > > mysql_close($connection); > > } > > ?> > > <table border="1"> > <tr> > <th width="33%" nowrap bgcolor="#00006F"><font > color="#FFFFFF"> > In The News Article > </font></th> > <th width="33%" nowrap bgcolor="#00006F"><font > color="#FFFFFF">Article > URL</font></th> > </tr> > <tr> > <td width="33%" align="center" > bgcolor="#C0C0C0"><input type="text" > name="Headline" size="20"></td> > <td width="33%" align="center" > bgcolor="#C0C0C0"><input type="text" > name="URL" size="20"></td> > </tr> > <tr> > <td width="66%" bgcolor="#C0C0C0" align="center" > colspan="2"> > <input type="submit" value="Add It" name="submit"> > <input type="reset" value="Clear Form" > name="reset"></td> > </tr> > </table> > </form> > </body> > </html> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#12573) next »