php4 + sqlite - quoting stuff

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

 



Hi all,

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

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($handle)));

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

-- 
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