2011-05-19 88 views
0

這是mysql的查詢權嗎?請注意該用戶是日期使用mysql和php存儲日期

 sprintf("INSERT INTO userinfo (username,userbdate,national,email, mobilenum,phonenum, 
         street,city,stateof , postoofice,country,lastcirt,cirt,specailzation,exper, 
         yearsofexper,notes) 
         VALUES ('%s', '%d' , '%s' , '%s' , '%d' , '%d' , 
         '%s','%s','%s','%s','%s','%s','%s','%s','%s', 
         '%d','%s')", 
         $user->getUserName(), 
         $user->getgetBirthDate(), 
         $user->getNational(), 
         $user->getEmail(), 
         $user->getMobilenum(), 
         $user->getPhonenum(), 
         $user->getPhonenum(), 
         $user->getStreet(), 
         $user->getCity(), 
         $user->getStateof(), 
         $user->getPostoffice(), 
         $user->getCountry(), 
         $user->getLastcirifacite(), 
         $user->getCirifacite(), 
         $user->getSpecailaztion(), 
         $user->getExper(), 
         $user->getYearsOfexper(), 
         $user->Notes(), 
         $userModel->getUserId()); 
+0

'postoofice'不知道這是故意還是打字錯誤 – 2011-05-19 18:35:16

回答

0

getgetBirthDate似乎是錯誤的(兩個得到的)。 你會更好地使用參數,並與任何格式問題完成。除此之外,你將不受SQL注入的影響。

1

你爲什麼不試試看?我們無法猜測你的所有價值。但我現在可以告訴你,如果任何的這些值在它們中有引號,那麼你的SQL查詢將被打破。查找SQL注入,訪問http://bobby-tables.com,並使您的查詢風險較小。

+0

毫米,這是一個主題的最終項目,我會嘗試在今年夏天閱讀它,但現在我已經完成它 順便說一句,我嘗試,但它沒有給我什麼! – 2011-05-19 18:37:20

+0

然後採取生成的查詢,並在mysql監視器中手動運行它。毫無疑問,您會收到錯誤消息。 'specailzation'看起來可疑。 – 2011-05-19 18:40:11