Re: Stuffing a paragraph of text into mySQL ????

From: Date: Fri, 08 Sep 2000 05:24:27 +0000
Subject: Re: Stuffing a paragraph of text into mySQL ????
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-2732@lists.php.net to get a copy of this message
You are correct! Thanks Joel!!!!! "Joel Sutton" <jsutton@itworks.com.au> wrote in message news:Pine.BSF.4.21.0009081610180.57215-100000@maybe.itworks.com.au... > Joey, > > The TEXT should should be ok, in my opinion. > > > insert into recipe (title,ingredients,directions,description,keywords) > > values ($rtitle,$ingredients,$directions,$description,$keywords) > > I think that the problem might be that you need to place quotes around the > text values: > > insert into recipe (title,ingredients,directions,description,keywords) > values > ('$rtitle','$ingredients','$directions','$description','$keywords') > > You might also like to check out the addslashes and stripslashes functions > so that your scripts can deal with having quotes in the body of the > text. The magic quotes configuration option might also help you with this. > > Hope this helps. > > Cheers, Joel... > > --- > Joel Sutton | > Software Developer | jsutton@itworks.com.au > ITworks Consulting | > http://www.itworks.com.au/ > Phone: +61+3+9642 5477 | Fax: +61+3+9642 5499 > Melbourne, Australia | "Perl, PHP, MySQL, MS Access 97" > > On Thu, 7 Sep 2000, Joey Garcia wrote: > > > I want to create a database for recipes (so my wife will cook!) but I am > > having trouble with my SQL. > > > > My Question: > > 1) I used field type "text" for paragraph type data such as description and > > directions. Was that field tpe correct choice? If not, what type? > > > > > > > > My system is a Windows 2k with Apache 1.3.12, mySQL 3.23.? and PHP4. > > > > My DB table is like this: > > > > Field Type Null Key Default > > ----- ---- ---- --- ------- > > rid int(11) PRI auto_increment > > title varchar(255) YES NULL > > ingredients text YES NULL > > directions text YES NULL > > description text YES NULL > > keywords varchar(128) YES NULL > > > > > > My SQL looks like this: > > insert into recipe (title,ingredients,directions,description,keywords) > > values ($rtitle,$ingredients,$directions,$description,$keywords) > > > > Here is the Error Message: > > Error Message: You have an error in your SQL syntax near 'cup orange juice > > 1 cup water > > 1/4 cup egg substitute > > 3/4 teaspoo' at line 1 > > > > Here is my recipe text: > > > > > > Orange Julius > > Description: > > Here's a quick-n-easy recipe from the first Top Secret Recipes book. Notice > > the egg substitute (which is made from egg whites) in the recipe. That's how > > you get a frothy, foamy drink. If you want a version of Strawberry and > > Pineapple Julius, check out the recipes in the second book, More Top Secret > > Recipes. > > > > Ingredients: > > 1 cup orange juice > > 1 cup water > > 1/4 cup egg substitute > > 3/4 teaspoon vanilla extract > > 1/4 cup sugar > > 1 heaping cup ice > > > > > > Directions: > > Combine all of the ingredients in a blender set on high speed for 15-30 > > seconds. (http://www.topsecretrecipes.com) > > Makes 2 drinks. > > > > The original recipe here and in the books includes real egg white, but, > > after many suggestions from readers I have replaced that with 1/4 cup egg > > substitute, which is mostly egg white and does a great job of making the > > drink foamy. If you like, you can instead use 2 tablespoons of the drink > > foam product Frothee. This is available in many supermarket liquor sections > > or in liquor stores. Or, if it\'s all you\'ve got available, you can still > > use 1 egg white from a large egg as originally specified in the recipe. > > > > > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > --- > Joel Sutton | > Software Developer | jsutton@itworks.com.au > ITworks Consulting | > http://www.itworks.com.au/ > Phone: +61+3+9642 5477 | Fax: +61+3+9642 5499 > Melbourne, Australia | "Perl, PHP, MySQL, MS Access 97" > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#2732) next »