| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Adding a record; PHP SQL ... | |
|---|---|
| Tweet Topic Started: May 10 2005, 12:41 AM (511 Views) | |
| James | May 10 2005, 12:41 AM Post #1 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
$sql = "insert into userstable(user, pass, email, location, homepage) values ( 'check_injection($username)' , 'check_injection($pass)' , 'check_injection($email)' , 'check_injection($location)' , 'check_injection($homepage)' )"; I have no idea what's going wrong, but up until that point everything seems okay in the file. the check_injection just outs to a function that does a stripslash and/or real_escape_string... but whatever I try, I can't get the data into the table. Something really simple i'm missing? |
![]() |
|
| Das | May 10 2005, 12:48 AM Post #2 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I am not an expert, but I have made the mistake many times myself, did you go over it, and make sure all the corect letters were capitalized and/or lowercase. Sql seems to be very strict about proper casing. If that dosn't work try it without check_injection and the ' marks aren't nessasry to the best of my knowladge. |
![]() |
|
| Sani | May 10 2005, 12:53 AM Post #3 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Try this..
|
![]() |
|
| James | May 10 2005, 12:58 AM Post #4 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Will do. But i just tried inserting: $sql = "insert into userstable values ( \"NULL\" , \"test\" , \"test\" , \"test@test.com\" , \"none\" , \"none\" )"; ...just some direct values. And it still didn't add... |
![]() |
|
| James | May 10 2005, 01:01 AM Post #5 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Nope...still no show in my userstable. Here's the full PHP file:
|
![]() |
|
| Sani | May 10 2005, 01:06 AM Post #6 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Haha, silly me.. ![]()
You (and me and Das) forgot the mysql_query command..
|
![]() |
|
| James | May 10 2005, 01:15 AM Post #7 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I'll kick myself for that one in the morning!
:\ |
![]() |
|
| Das | May 10 2005, 01:15 AM Post #8 |
![]()
Smells of rich mahogany
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Da*nit the second time
|
![]() |
|
| Sani | May 10 2005, 01:25 AM Post #9 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I could be wrong, but.. Try changing
to
|
![]() |
|
| James | May 10 2005, 09:41 AM Post #10 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yeahhhhhhhhhhhh!!! Go you
|
![]() |
|
| Rory | May 10 2005, 11:40 AM Post #11 |
|
i;m a mess
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
and just think, you could have saved yourself all this hassle by doing the escaping before the query. That way, it looks nicer
|
![]() |
|
| Seth | May 10 2005, 01:23 PM Post #12 |
|
I has a pony
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
what Roree said.Better to pass values that have already been escaped, rather than escaping inline. |
![]() |
|
| James | May 10 2005, 05:08 PM Post #13 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
eehhh? Like..create a clean array of values and drop them in? Me don't understand why that's better? |
![]() |
|
| Rory | May 10 2005, 05:24 PM Post #14 |
|
i;m a mess
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
because you wouldn't have all this: "" . blah . "" you would just have values('$var1','$var2') would be much much easier to read and find problems with
|
![]() |
|
| James | May 10 2005, 05:29 PM Post #15 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Ohhh. To be honest, if there was a massive gorilla in the middle of my PHP script i still wouldn't be able to find it. But thanks, i'll take note!
|
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Technology Chat · Next Topic » |
| Track Topic · E-mail Topic |
8:34 AM Jul 11
|



![]](../../../../0/1/0/p601690/pipright.png)





8:34 AM Jul 11