php 4.0.5 to php 4.2.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I originally wrote some php scripts (php 4.0.5) which would update my mysql
database. Now i need to move to a different server (php 4.2.2) and now i
can't get my INSERT query to work now. Is there something i don't know about
upgrading versions of php?


<html>
<body>
<?php

 $host="www.freesql.org";
 $user="***";
 $password="********";

 //Connect and select the database for use
 $db = mysql_connect($host,$user,$password) or die("Could not connect: " .
mysql_error());
 mysql_select_db("55yardline",$db);

        $result = mysql_query("SELECT * FROM news WHERE id < 50",$db);

          if ($myrow = mysql_fetch_array($result)) {
              echo "<table border=0 width=600 align=center>\n";
              echo "<tr><td>News</td></tr>\n";
                do
                  {

printf("<tr><td><b>%s</b></td></tr><tr><td>%s<br><br><br><br></td></tr>\n",
$myrow["title"], $myrow["copy"]);
                  }
                  while ($myrow = mysql_fetch_array($result));
              echo "</table>\n";
            }
          else
            {
              echo "Sorry, no records were found!";

            }



if ($submit) {
          $sql = "INSERT INTO news (title,copy) VALUES ('$title','shit')";
          $result = mysql_query($sql);
          echo "Thank you! Information entered.\n";
          } else{
?>

            <form method="post" action="<?php echo $PHP_SELF?>">
            Enter Data:<textarea name="title" cols="75"
rows="10"></textarea>
            <input type="Submit" name="submit" value="Enter information">
            </form>

<?php
          }
?>

</body>
</html>



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux