Insert MySQL/PHP

From: Date: Sun, 04 Aug 2002 20:55:47 +0000
Subject: Insert MySQL/PHP
Groups: php.db 
Request: Send a blank email to php-db+get-20982@lists.php.net to get a copy of this message
Using RH 7.3 PHP 4.2.2 MySQL 3.23.51 MySQL Client 3.23.29 Apache 1.3.26 I used the LAMP script to compile and build all and all of the PHP works except for inserts. I can insert from MyCC, phpMyAdmin, command line just fine but when trying to use a php file that I used to use it will not insert or show any errors.PS I like MyCC!!! Very nice!! I made the file chmod 666 and tried both my root and my normal user accounts. Here's the code.Note: I changed the names to post so one might be wrong<G> <? // if form has not been submitted, display form if (!$submit) { ?> <html> <head> <basefont face=Arial> <h3>Enter the upload sites:</h3> <form method="POST" action="insert.php"> <table> <tr> <td> sitename </td> <td> <input name="sitename" length="10" maxlength="50"> </td> </tr> <tr> <td> sent link </td> <td> <input name="sent_link" length="30" maxlength="30"> </td> </tr> <tr> <td> notes </td> <td> <input name="notes" length="60"> </td> <tr> <td> asta </td> <td> <input name="home" length="30"> </td> </tr> <tr> <td> wireless </td> <td> <input name="wireless" length="30" maxlength="30"> </td> </tr> <tr> <td> wired </td> <td> <input name="wired" length="30" maxlength="30"> </td> </tr> <tr> <td> day 2001-07-01 </td> <td> <input name="day" length="11" maxlength="11"> </td> </tr> <td colspan="2" align="center"> <input type="submit" name="submit" value="Submit"> </td> </tr> </table> </form> </body> </html> <? } // or process form input else { ?> <?php // connect to database $connection = mysql_connect("localhost", "me", "canttellyou") or die("Invalid server or user"); // select database mysql_select_db("insert",$connection); // formulate and run query $query = "insert into skywire(sitename,sent_link,notes,home,wireless,wired,day) values('$sitename','$sent_link','$notes','$home','$wireless','$wired','$day')"; $result = mysql_query($query,$connection) or die("Error in query"); ?> <html> <head> <basefont face=Arial> </head> <body> <center> <P>Success!</43> <table> <tr> <td> <?php echo $username; ?> uploads have been saved. </td> </tr> <p>Return to the list <a href="home.php">home list</a></p> </center> </body> </html> <? } ?> Cheers Mike

« previous php.db (#20982) next »