Jump to content

sparky

Members
  • Posts

    9
  • Joined

  • Last visited

About sparky

  • Birthday 06/24/1961

Profile Information

  • Gender
    Male
  • Location
    Memphis, TN, USA
  • Age
    52

sparky's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have an issue as to where I am trying to save long amounts of data into a database, and nothing that I try seems to work.... The field $detail when I have more than a coupld lines of data just does not write the data... Note code below: Viewing the $SQL Data all shows correct... Just does not write it to the Database. I have tried changing to blob and other selections in the MYSQL, but not seeing what I am doing wrong. thanks in advance for any advice. John Database: ---------------------- -- phpMyAdmin SQL Dump -- version 3.5.0 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Feb 06, 2014 at 09:30 AM -- Server version: 5.5.23 -- PHP Version: 5.3.13 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `elsa` -- -- -------------------------------------------------------- -- -- Table structure for table `timeline2` -- CREATE TABLE IF NOT EXISTS `timeline` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mo` text, `mon` text, `da` text, `yr` text, `hdr` text, `detail` longtext, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Elsa Time Line' AUTO_INCREMENT=4 ; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; ---------------------- Insert Code: ---------------------- <?php // open the connection $conn = mysql_connect("localhost", "xxxx", "xxxx"); // pick the database to use mysql_select_db("elsa",$conn); // create the SQL statement $mo=$_POST[mo]; $mon=$_POST[mon]; $da=$_POST[da]; $yr=$_POST[yr]; $hdr=$_POST[hdr]; $detail=$_POST[detail]; $sql = "INSERT INTO timeline2(mo, mon, da, yr, hdr, detail) values ('$mo', '$mon', '$da', '$yr', '$hdr', '$detail')"; echo $sql; echo "<BR>"; // execute the SQL statement if (mysql_query($sql, $conn)) { echo "Record Updated!"; } else { echo "Something went Wrong"; } ?> ---------------------- Example data that does not work. ---------------------- <P ALIGN=CENTER> Elsa's Journey to her new home in Memphis</P> <CENTER> <P ALIGN=CENTER> <iframe title="YouTube video player" class="youtube-player" type="text/html" width="640" height="510" src="http://www.youtube.com/embed/EJufDyBse8s" frameborder="0" allowFullScreen></iframe></P> </CENTER> <P ALIGN=CENTER> <!-- $MVD$:spaceretainer() --> </P> <P ALIGN=CENTER> Elsa at Home</P> <P ALIGN=CENTER> <A HREF="assets/140131/index.htm"><IMG SRC="assets/140131/elsa-013114-01_std.jpg" WIDTH="536" HEIGHT="800" VSPACE="0" HSPACE="0" BORDER="0"> <BR> Click on IMAGE </A></P> <P ALIGN=CENTER> <!-- $MVD$:spaceretainer() --> </P> <P ALIGN=CENTER> Elsa VS the Video Camera.</P> <CENTER> <P ALIGN=CENTER> <iframe title="YouTube video player" class="youtube-player" type="text/html" width="640" height="510" src="http://www.youtube.com/embed/DTWntrEVuUs" frameborder="0" allowFullScreen></iframe></P> </CENTER> <P ALIGN=CENTER> A Very long Day for just a little Kitty...</P> <P ALIGN=CENTER> <IMG SRC="assets/140131/Sleeping.jpg" WIDTH="640" HEIGHT="480" VSPACE="0" HSPACE="0" BORDER="0"></P> <P ALIGN=CENTER> She was laying under her cat tree... When I turned off the lights (from remote) she got up and went to her cat bed and fell asleep.</P>
  2. It has been a while since I have done much programming at all, and where I know I have been through this before I am getting an "Undefined Varible Error" Where this works coming from a form submission: echo $_POST["co1"]; echo $_POST["co2"]; echo $_POST["co3"]; This does not work: $s1 = $_post["co1"]; $s2 = $_post["co2"]; $s3 = $_post["co3"]; What stupid function am I overlooking or doing wrong. Thanks in advance. John
  3. I need a routine that will change all data that is in a field to something else... Example: where class=\"abc\", I want to change it to class=\"123\"/ Thanks in advance.
  4. Not sure.. I am quite a novice... I tried using replace command and really got lost with it... I finally got the replace command working and it is doing great now. Thanks for the comment. All of them are welcome. sparky
  5. Minor goof on my end... Is writing data, but duplicating the record. I feel that I am pretty close, but not quite there. WHen it duplicates it, it also is incrementing the index counter.
  6. I am trying to use: $sql = \"REPLACE INTO newinv (id, item, dir, fn, price, class, dis, inv) VALUES (\'$_POST[id]\', \'$_POST[item]\', \'$_POST[dir]\' , \'$_POST[fn]\', \'$_POST[price]\', \'$_POST[class]\',\'$_POST[dis]\',\'$_POST[inv]\')\"; Is there a problem with the \'$_POST[id]\', routine... WHen I use this, for some reason it is writing a new record that is blank.
  7. I am not understanding the SELECT clause on this. I am missing the big picture on this for some reason.
  8. I feel like I am overlooking so ever minor, but unable to find it. What the problem is, when I edit a record, it either does not save, or it creates a duplicate. Make note, my insert code works perfectly, but my replace code does not. Note both: works for inserting records <?php // open the connection $conn = mysql_connect(\"localhost\", \"xxxx\", \"xxxx\"); // pick the database to use mysql_select_db(\"galleria\",$conn); // create the SQL statement $sql = \"INSERT INTO newinv values (\'*\', \'$_POST[item]\', \'$_POST[dir]\', \'$_POST[fn]\', \'$_POST[price]\', \'$_POST[class]\', \'$_POST[dis]\', \'$_POST[inv]\')\"; // execute the SQL statement if (mysql_query($sql, $conn)) { echo \"Record Updated!\"; } else { echo \"Something went Wrong\"; } ?> Does NOT work for Editing/Replacing records <?php // open the connection $conn = mysql_connect(\"localhost\", \"xxxx\", \"xxxx\"); // pick the database to use mysql_select_db(\"galleria\",$conn); // create the SQL statement $sql = \"REPLACE INTO newinv (\'$_POST[id]\', \'$_POST[item]\', \'$_POST[dir]\', \'$_POST[fn]\', \'$_POST[price]\', \'$_POST[class]\', \'$_POST[dis]\', \'$_POST[inv]\') WHERE \'id\'=id\"; // execute the SQL statement if (mysql_query($sql, $conn)) { echo \"Record Updated!\"; } else { echo \"Something went Wrong\"; } ?> ------------------------- The following is the page following that generates the data to be saved. <html> <body bgcolor=#FCF8A0> <?php // open the connection $conn = mysql_connect(\"localhost\", \"xxxx\", \"xxxx\"); // pick the database to use mysql_select_db(\"galleria\",$conn); // create the SQL statement $ids = $_GET[ \'ids\' ]; $sql = \"SELECT * FROM newinv WHERE id=\'$ids\'\"; // execute the SQL statement $result = mysql_query($sql, $conn) or die(mysql_error()); //go through each row in the result set and display data while ($newArray = mysql_fetch_array($result)) { // give a name to the fields $id = $newArray[\'id\']; $item = $newArray[\'item\']; $dir = $newArray[\'dir\']; $fn = $newArray[\'fn\']; $price = $newArray[\'price\']; $class = $newArray[\'class\']; $dis = $newArray[\'dis\']; $inv = $newArray[\'inv\']; } ?> <p align=center> <table cellpadding=\"2\" cellspacing=\"2\" width=\"600\"> <form method=\"POST\" action=\"EditInsert.php\"> <CENTER> <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"> <tr> <td width=\"50%\"> Item Name </td> <td width=\"50%\"> <input type=\"text\" name=\"item\" size=\"30\" value=\"<?php echo $item; ?>\"> </td> </tr> <tr> <td width=\"50%\"> Directory </td> <td width=\"50%\"> <input type=\"text\" name=\"dir\" size=\"30\" value=\"<?php echo $dir; ?>\"> </td></tr> <td width=\"50%\"> FileName </td> <td width=\"50%\"> <input type=\"text\" name=\"fn\" size=\"30\" value=\"<?php echo $fn; ?>\"> </td> </tr> <td width=\"50%\"> Inventory Number </td> <td width=\"50%\"> <input type=\"text\" name=\"inv\" size=\"15\" value=\"<?php echo $inv; ?>\"> </td> </tr> <td width=\"50%\"> Sale Price ($) </td> <td width=\"50%\"> <input type=\"text\" name=\"price\" size=\"7\" value=\"<?php echo $price; ?>\"> </td> </tr> <td width=\"50%\"> Classification </td> <td width=\"50%\"> <select name=\"class\"> <OPTION>Select Classification <OPTION>Bazzar <OPTION>African path - Clothing </SELECT> </td> </tr> <td> <center> <img src=\"http://www.galleriaonline.com/inv/<?php echo $dir; ?>/<?php echo $fn; ?>\"> </center></td> <td width=\"50%\"> Discription<BR> (As much as you want) <TEXTAREA NAME=\"dis\" \" COLS=\"60\" ROWS=\"12\" input type=\"text\"><?php echo $dis; ?></TEXTAREA> </td> </tr> </td> </tr> </table> </tr> <tr> <td width=\"50%\"> </td> <td width=\"50%\"> <input type=\"submit\" value=\"Submit Item\" name=\"btnSubmit\"> </td> </tr> </table> </form> <HR><BR><BR> </body> </html> ------------- Thanks for any assistance on this.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.