Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

php4 + sqlite - quoting stuff
Hi all,

I'm a kinda-sorta newbie to php -- I basically just futz around with it
because it's pretty .

However, I'm brand spanking new to databases.  Never did anything with them.
I taught myself a little SQL because it looked fun to learn, but I just
thumbed through some books.  I never really used a database in earnest.  Too
difficult to set up, and my dual Celeron 333 is underpowered as it is
without having an extra daemon running.

Yesterday, I taught myself sqlite + perl, and that was a LOT of fun.  But
then I remembered I hate using perl for CGI, so today I started messing
around with sqlite for php4.

There's something I'm not groking about php's syntax.  When I look at how
you're supposed to quote stuff in sqlite for php4:

sqlite_query( $handle, "
INSERT INTO course VALUES (
'" . sqlite_escape_string($termcode)    . "',
'" . sqlite_escape_string($semester)    . "',
'" . sqlite_escape_string($course)      . "',
'" . sqlite_escape_string($course_desc) . "',
'" . sqlite_escape_string($college)     . "',
'" . sqlite_escape_string($reference)   . "'
)
") or die("Error bravo in query: " .
 sqlite_error_string(sqlite_last_error($h
andle)));

it makes me want to cry.  Php should be prettier than Perl, not uglier.  We
have single quotes, double quotes and a string quote function.

How am I supposed to parse this?  What's the purpose for all this quoting?

And is there a _nicer_ way of doing this?

Thanks!
Pete

PS- I don't want to count out the possibility that some of my values have
quote characters in them.

--
The mathematics of physics has become ever more abstract, rather than more
complicated.  The mind of God appears to be abstract but not complicated.
He also appears to like group theory.  --  Tony Zee's "Fearful Symmetry"

GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D

Report this thread to moderator Post Follow-up to this message
Old Post
Peter Jay Salzman
12-25-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:24 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.