kool_samule Posted April 13, 2010 Share Posted April 13, 2010 Hi Chaps, Maybe a simple answer to this one, I have two input fields, which I want to combine into 1 SQL column. Inputs: <input type="text" name="job_no" value="00001" size="32" /> <input type="text" name="job_model" value="MODEL_A" size="32" /> SQL: "INSERT INTO tbl_job (job_title) VALUES (%s)", GetSQLValueString($_POST['job_no'], "text").GetSQLValueString(' - '.$_POST['job_model'], "text"); This produces: job_title = 00001' - MODEL_A Problem: Notice the character after the job_no. . . .how do I get rid of this? Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted April 13, 2010 Share Posted April 13, 2010 Why is it there in the first place? What is this function: GetSQLValueString(). Also, why are you storing them both in a single column? it would make sense to make a relation between tables if your database data starts getting complicated. Quote Link to comment Share on other sites More sharing options...
kool_samule Posted April 13, 2010 Author Share Posted April 13, 2010 hi, thanks for the reply. . . I'm aware of the way to normally do things, this is a unique field that must NOT be NULL, and takes it's name from two different inputs. GetSQLValueString() is an Adobe DreamWeaver built-in function. Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted April 13, 2010 Share Posted April 13, 2010 Ok well you have a few options: [a] Drop dreamweaver and code like a pro - so you can know your code (you typed it all) or you will have serious issues later on. Get rid of that single quote with str_replace(), or substr(). (This is lazy). [c] * Reccomended Fix the code thats adding that to it for some reason. I reccommend C because it will prbably benefit you the most. To do this: First debug the values, put this before the query. echo(GetSQLValueString($_POST['job_no'], "text").GetSQLValueString(' - '.$_POST['job_model'], "text")); If it is correct, then you need to find out whats going on in that dreamweaver function.. or better yet write your own. If it is wrong, then somewhere up is the error, maybe from the previous page, you can check post values at the start to check they are what they are expected to be. -CB- Quote Link to comment Share on other sites More sharing options...
kool_samule Posted April 13, 2010 Author Share Posted April 13, 2010 Coolio, sorted it, thanks for the advice. I altered the function that was inserting '/" marks between text, double, date, float data types. Out of interest, what do you use to do your coding? notepad? Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted April 13, 2010 Share Posted April 13, 2010 I personally use Notepad++, for these reasons: 1. Can be downloaded in seconds, small file. 2. Low Resource Footprint (Loads on computer fast). 3. Multiple language support, programming and dialects. 4. Activaly maintained and updated. 5. Decent Syntax highlighting for Most Languages. 6. Moddable, Extensible and overall more versatile. 7. Free 8. Its just a decent program, decent features, multi search replace, everything you need. and it remembers what you had open etc its just perfect for single projects. -CB- Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.