Shadowing Posted December 23, 2011 Share Posted December 23, 2011 on the first column do I need to escape that? "pm_id" if so how do i do that with the right syntax is it like this? pm_id = '.mysql_real_escape_string.' <?php $mail2 = "INSERT INTO pm SET pm_id = '', sendto = '".mysql_real_escape_string($to)."', sentfrom = '".mysql_real_escape_string($from)."' ?> Also when you create a new row with a id having auto increment. do i have to do id ="" so there isnt ever two rows matching the same id? Link to comment https://forums.phpfreaks.com/topic/253729-question-on-mysq1-real-escape-string/ Share on other sites More sharing options...
trq Posted December 23, 2011 Share Posted December 23, 2011 Your not inserting any data so there is nothing to escape. And no, just update the columns you wish to update. Link to comment https://forums.phpfreaks.com/topic/253729-question-on-mysq1-real-escape-string/#findComment-1300771 Share on other sites More sharing options...
Shadowing Posted December 23, 2011 Author Share Posted December 23, 2011 alright so only escape when im taking information from a user form and updating or inserting right? any idea about the id duplicating question? really curious about that Link to comment https://forums.phpfreaks.com/topic/253729-question-on-mysq1-real-escape-string/#findComment-1300785 Share on other sites More sharing options...
trq Posted December 23, 2011 Share Posted December 23, 2011 As I said, you only need to update the fields you actually want to update. Trying to set an auto incrementing field to an empty string "" will only cause an error. Link to comment https://forums.phpfreaks.com/topic/253729-question-on-mysq1-real-escape-string/#findComment-1300786 Share on other sites More sharing options...
Shadowing Posted December 23, 2011 Author Share Posted December 23, 2011 oh so mysql wont give another row the same id cause its just built not to do that? Link to comment https://forums.phpfreaks.com/topic/253729-question-on-mysq1-real-escape-string/#findComment-1300789 Share on other sites More sharing options...
trq Posted December 23, 2011 Share Posted December 23, 2011 Sorry, i didn't notice your example was an INSERT query. Most people don't use that syntax for an insert. Anyway, It's not called "auto increment" for nothing. Link to comment https://forums.phpfreaks.com/topic/253729-question-on-mysq1-real-escape-string/#findComment-1300790 Share on other sites More sharing options...
Shadowing Posted December 23, 2011 Author Share Posted December 23, 2011 ok good then so i can leave it out and not have to worry about someone getting the same id someone said i had to do that in a tutor i was doing like 3 weeks ago so i always wonder if it was true thanks alot for the help thorpe Link to comment https://forums.phpfreaks.com/topic/253729-question-on-mysq1-real-escape-string/#findComment-1300792 Share on other sites More sharing options...
trq Posted December 23, 2011 Share Posted December 23, 2011 someone said i had to do that in a tutor i was doing like 3 weeks ago so i always wonder if it was true I would suggest you misunderstood the tutorial or it was poorly written. You cannot insert a string into an integer type field. Link to comment https://forums.phpfreaks.com/topic/253729-question-on-mysq1-real-escape-string/#findComment-1300806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.