Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2005-03-25, 10:23 AM   #1
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
Putting HTML in a form on a PHP page to submit to a mySQL db

Ok, here's the thingy. I used to be able to insert HTML tables and such into my form so that it would insert it into my database and eventually get pulled onto my templates. Now I can't. I can submit the brackets <> by themselves without space between them without a problem, but if a character or space is separates them, I get an Internal Server Error.

Could this be some software variable on my server that is causing this? I'm thinking that this error started when I moved from my virtual account onto a dedicated server. Perhaps something on the php.ini?

Help.........................
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote
Old 2005-03-25, 10:42 AM   #2
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
You probably had safe quoting on the old server, and it is off on the new server.

Personally, rather than adjust the new default (which is safer), you might want to adjust your methods for processing input to avoid SQL injection. I'm surprised it is a space that is causing the problem and not something like a " or a '

you might wrap your variables with addslashes() and see if that is indeed the problem. otherwise, try printing the actual query that is being executed, and cut and paste it into mysql's command line interface or phpmyadmin to see what is actually breaking.
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2005-03-25, 11:10 AM   #3
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
What is a good book to buy for the MySQL challenged? I've bought a few books on php that talked about MySQL but that is about it.

Mostly I want to better understand writing queries when I'm in PhpMyAdmin doing search and replace, deletes, etc.

Something for a user not someone writing code.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2005-03-25, 11:36 AM   #4
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
Personally, I find the source code to be an invaluable reference for working with mysql.

As for a book, I bought one of my guys, the MySQL Administrator Guide, http://www.amazon.com/exec/obidos/tg...l/-/0672326345 (affiliate code stripped off)

It was one of the few that went indepth into a few issues that were quite important (indexes & joins), but, might be a tough read and perhaps not really for general use/consumption.

There was another one that I saw at the bookstore, Beginning Mysql from Novice to Professional. I flipped through the pages, it was a much more cursory overview, and seemed written well.

I used to be a fan of the Zoo books (O'Reilly), but, lately, their content quality seems to have gone downhill.

My personal preference is always a reference style book, some people prefer tutorial type books. If I get a chance this weekend, I'll go to the bookstore and read through a few.
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2005-03-25, 11:42 AM   #5
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
MySQL Administrator Guide seems like it would be a bit much.

I get the VIsual Quickstart Guide by Peachpit press for just about everything but I haven't looked what they have for MySQL. Luna is coming over this afternoon and since she also likes bookstores maybe the two of us will go over to Borders and see what they have.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2005-03-25, 11:50 AM   #6
Barron
You tried your best and you failed miserably. The lesson is 'never try'
 
Join Date: Oct 2004
Posts: 166
Quote:
Originally Posted by Cleo
What is a good book to buy for the MySQL challenged? I've bought a few books on php that talked about MySQL but that is about it.

Mostly I want to better understand writing queries when I'm in PhpMyAdmin doing search and replace, deletes, etc.

Something for a user not someone writing code.
I bought "Web Database Applications with PHP & MySQL" by O'Reilly. The book I have is written for PHP 4.06 and MySQL 3.23.38. I'm sure that there would be an updated version of the book by now.

I bought it at Barnes & Noble for 45.00. I would suggest checking out one of the local book stores so you can thumb through pages and see if the book has what your looking for.

In this book the example website is a wine store. Really nice examples on how to use MySQL calls.


-
Barron is offline   Reply With Quote
Old 2005-03-25, 11:54 AM   #7
Barron
You tried your best and you failed miserably. The lesson is 'never try'
 
Join Date: Oct 2004
Posts: 166
oops, I should have refreshed before posting
Barron is offline   Reply With Quote
Old 2005-03-25, 12:20 PM   #8
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
This is the one I have. http://www.amazon.com/exec/obidos/AS...229078-5441724
I've successfully wreaked havoc on many fine scripts with it.
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote
Old 2005-03-25, 01:16 PM   #9
Thumbler
You can now put whatever you want in this space :)
 
Join Date: Aug 2003
Location: GA
Posts: 598
I've got (amongst others) 'PHP and MySQL Web Development' by Luke Welling and Laura Thomson. It's very thick so it must be good
__________________
Out of date sig!
Thumbler is offline   Reply With Quote
Old 2005-03-25, 01:36 PM   #10
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Quote:
Originally Posted by Useless Warrior
This is the one I have. http://www.amazon.com/exec/obidos/AS...229078-5441724
I've successfully wreaked havoc on many fine scripts with it.
That is the Pro version of the Visual Quickstart Guides. I found out about the Pro versions when I went looking for one for Final Cut Pro.

They are good stuff. I stopped using the 6 inches of manuals that came with Final Cut Pro after getting the Visual Quckpro Guide for it.

Going to check out PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide later today.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2005-03-25, 02:31 PM   #11
ronnie
Wheither you think you can or you think you can't, Your right.
 
Join Date: Jun 2004
Location: midwest
Posts: 2,274
Send a message via ICQ to ronnie
Quote:
Originally Posted by Cleo
What is a good book to buy for the MySQL challenged? I've bought a few books on php that talked about MySQL but that is about it.

Mostly I want to better understand writing queries when I'm in PhpMyAdmin doing search and replace, deletes, etc.

Something for a user not someone writing code.
Actually phpmyadmin can be a great help, least has been for me. Being that it shows the queries it runs. Has helped me out on more than a few occasions to figure things out.

I also get a ton of help on the forums, sitepoint is an excellent resource. I always get a answer and usually quite quickly.

ronnie
ronnie is offline   Reply With Quote
Old 2005-03-25, 05:02 PM   #12
venturi
No offence Apu, but when they were handing out religions you must have been out taking a whizz
 
Join Date: Apr 2003
Location: An Oasis atop a High Desert Mesa
Posts: 282
Send a message via ICQ to venturi
Quote:
Originally Posted by Useless Warrior
Ok, here's the thingy. I used to be able to insert HTML tables and such into my form so that it would insert it into my database and eventually get pulled onto my templates. Now I can't. I can submit the brackets <> by themselves without space between them without a problem, but if a character or space is separates them, I get an Internal Server Error.

Could this be some software variable on my server that is causing this? I'm thinking that this error started when I moved from my virtual account onto a dedicated server. Perhaps something on the php.ini?

Help.........................
When you are processing the form data to insert it into your database use:
htmlentities($_POST['form_field'], ENT_QUOTES);
When you are pulling the data out of the database to insert into your templates use:
html_entity_decode($query->field, ENT_QUOTES); // assuming you are using mysql_fetch_object() to retrieve your query data.
venturi is offline   Reply With Quote
Old 2005-03-25, 05:37 PM   #13
codemonkey
WHO IS FONZY!?! Don't they teach you anything at school?
 
Join Date: Oct 2004
Posts: 44
Send a message via ICQ to codemonkey Send a message via Yahoo to codemonkey
A good thing that we used to subscribe to was O'reilly's safari - where they publish all of their books online in a searchable format. You pay a subscription each month and can have a number of books on your "bookshelf" at one time. They give you a free 14 day trial and it could be worth a look as you get the whole books online and if you prefer reading proper books you can always buy the book if it's useful.

http://safari.oreilly.com/
__________________
BBW modelling competitions
codemonkey is offline   Reply With Quote
Old 2005-03-27, 08:33 PM   #14
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
Son of a bitch!

Whatever setting I have on this server that isn't allowing my little form to work is also keeping me from using any type of code on my blog entries.

Son of a bitch!
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:54 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc