|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I first have a page with 80 fields the user types in, then they can run a search on all entries, and then click a button to modify any one user. The "update page" runs by inserting all data from the database in to text fields and then the user can click "Submit Changes" to update all the fields. I need help with the query used to run the update - I think I may be close but I'm still getting errors, and I'm really not sure why.
PHP Code:
Now I have about 70 more fields but I didn't write them all for simplicity purposes (and I dont think the error is in the fields). Thanks a lot guys! |
|
#2
|
|||
|
|||
|
Try the ansi correct update syntax
Update student SET stuf_name= \"$stuf_name\", stul_name= \"$stul_name\", . . . . Where ..... plus maybe enclose your where clause hid_stuuser = \"$user\" EDIT:: I hope your stripping out special characters, you have potential for an SQL-injection attack here. If your using MS SQL (or a database that supports them) use stored procedures where possible |
|
#3
|
|||
|
|||
|
The fix worked, for whatever reason I didn't think I had to go column by column and that I chould shortcut it like that.
Please read my PM when you get a second also - thanks a lot for the help. |
|
#4
|
||||
|
||||
|
it's probably mysql, not ms sql, because of the doublequotes used to delimit strings
only mysql allows that nonsense ![]() |
|
#5
|
|||
|
|||
|
Quote:
I'm using MSSQL and PHP but everything I learned is from a MYSQL book. I basically came into a situation where MSSQL server was already installed, I had no background experience using it really, and then I was asked to create a web interface to add, delete, modify, etc to our records. If I'm running into security problems and this form needs to be internal only - I couldn't imagine that being a problem. So everything I'm learning is pretty much on the fly, and I want to give big props to this community for all the help. |
|
#6
|
||||
|
||||
|
Quote:
starting with the proper way to delimit strings ![]() |
|
#7
|
|||
|
|||
|
Quote:
So in short, you’re saying it's time I invest a little money into amazon.com. MSSQL for Dummies for Dummies any one? If you know any good books for beginners let me know - I wouldn't mind getting in to this stuff and trying to learn it legitimately. |
|
#8
|
||||
|
||||
|
you won't need a book if you've already learned sql via mysql
yes, there are many subtle differences in the dialects of mysql's sql and mssql's sql (that's the beauty of standards -- there are so many to choose from) looking stuff up in da mssql manual (Books OnLine, or BOL as it is affectionately known) is probably all you need |
|
#9
|
|||
|
|||
|
Quote:
I think saying I've already learned SQL via mysql is a long strech. I know the very basics - but really wouldnt mind getting into advanced basics and then maybe some intermediate things. I see these references to BOL all the time, and I'm guessing you guys mean the MSDN SQL Server Dev site? It's the only site I could Google that made any sense. I really wouldn't mind getting a couple books for learning and reference though - maybe a PHP/SQL book or something. If you have anything in mind let me know, and again thanks for all the help. |
|
#10
|
||||
|
||||
|
if you're using SQL Server in any form (except perhaps the free version), BOL comes with the install, look around on your hard drive
Sam's Teach Yourself SQL in 10 Minutes (LOL!!!) is actually pretty good O'Reilly's SQL pocket guide is also good |
|
#11
|
|||
|
|||
|
Quote:
Err I've read the PM but currently cant reply to them as I don't have enough posts made here. I'll write something up later regarding it. As for general database advice ..... dont do what I did about 30 minutes ago and truncate a live table ... Thank goodness for backupsEDIT :: Yes I know I should of been using transactions and wasn't, though I thought I was on the Dev system at the time. |
|
#12
|
|||
|
|||
|
Quote:
And I'm taking advice from this guy? hah thanks for the help.One more question, then I'm done honestly. I need a query that does four things. First Name = Frank Last Name = Leppar User ID = 300503 I need a fourth field that grabs the fi of first name, fi of last name, makes them both lower case, and then combines it with the student id: eq: fl300503 Not hard right? ![]() *Edit* - I apologize on this one but I have no idea where to even get started on this. Again this is on a PHP site so I'm sure that will help. |
|
#13
|
|||
|
|||
|
Quote:
Ok About to leave for the day so I dont have time to work out the exact syntax, but it should be something like LOWER(SUBSTRING(0,1,[First Name]) + LOWER(SUBSTRING(0,1,[Last Name]) + [User ID] Where the items in [] are the fields, check the substring syntax on BOL though |