PHP / MySQL插入查询(PHP/MySQL Insert Query)
对于我的生活,我无法得到这个插入查询的工作。
mysql_connect("**host**", "**username**", "**password**") or error("Could not connect: ".mysql_error()); mysql_select_db("**db_name**"); $db = mysql_query("INSERT INTO `pass_reset` (id,status,key,email) VALUES ('','0','$key','$email')");
它返回这个错误:
你的SQL语法有错误; 检查与您的MySQL服务器版本相对应的手册,以便在第1行的'key','email'附近使用正确的语法VALUES('','0','','')'
有人可以帮助我吗? 我通过这个简单的查询从字面上拉我的头发。
For the life of me I can't get this insert query to work.
mysql_connect("**host**", "**username**", "**password**") or error("Could not connect: ".mysql_error()); mysql_select_db("**db_name**"); $db = mysql_query("INSERT INTO `pass_reset` (id,status,key,email) VALUES ('','0','$key','$email')");
It returns this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key,email) VALUES ('','0','','')' at line 1
Could someone help me with this? I'm literally pulling my hair out over this simple query.
原文:https://stackoverflow.com/questions/6713478
最满意答案
试试这个,在iTunes中选择一个或多个曲目并运行脚本。
如果分隔符应该是分号+空格,请更改第二个属性行。
如果类型属性不包含分隔符,则不会更改任何内容。
如果类型与排序列表中的项目不匹配,则将在末尾附加。
property sortedGenreList : {"Rock", "Dance", "Art Rock", "New Wave", "Female Vocalists", "Male Vocalists"} property separator : ";" tell application "iTunes" to set selectedItems to (get selection) if selectedItems is {} then display dialog "Nothing selected" buttons {"Cancel"} default button 1 end if set {TID, text item delimiters} to {text item delimiters, separator} repeat with aTrack in selectedItems set orderedGenreList to {} set nonOrderableGenres to {} tell application "iTunes" to set trackGenreList to text items of (get genre of aTrack) if (count trackGenreList) > 1 then repeat with aGenre in trackGenreList if sortedGenreList does not contain aGenre then set end of nonOrderableGenres to contents of aGenre end repeat repeat with aGenre in sortedGenreList if trackGenreList contains aGenre then set end of orderedGenreList to contents of aGenre end if end repeat set orderedGenres to (orderedGenreList & nonOrderableGenres) as text tell application "iTunes" to set genre of aTrack to orderedGenres end if end repeat set text item delimiters to TID
如果要使用每行类型的文本文件替换第一个属性行
set sortedGenreList to paragraphs of (read (choose file))
Try this, select one or multiple tracks in iTunes and run the script.
If the separator is supposed to be semicolon + space, please change the second property line.
If the genre property does not contain the separator, nothing will be changed.
If a genre does not match the items in the sorted list it will be appended at the end.
property sortedGenreList : {"Rock", "Dance", "Art Rock", "New Wave", "Female Vocalists", "Male Vocalists"} property separator : ";" tell application "iTunes" to set selectedItems to (get selection) if selectedItems is {} then display dialog "Nothing selected" buttons {"Cancel"} default button 1 end if set {TID, text item delimiters} to {text item delimiters, separator} repeat with aTrack in selectedItems set orderedGenreList to {} set nonOrderableGenres to {} tell application "iTunes" to set trackGenreList to text items of (get genre of aTrack) if (count trackGenreList) > 1 then repeat with aGenre in trackGenreList if sortedGenreList does not contain aGenre then set end of nonOrderableGenres to contents of aGenre end repeat repeat with aGenre in sortedGenreList if trackGenreList contains aGenre then set end of orderedGenreList to contents of aGenre end if end repeat set orderedGenres to (orderedGenreList & nonOrderableGenres) as text tell application "iTunes" to set genre of aTrack to orderedGenres end if end repeat set text item delimiters to TID
If you want to use a text file with a genre per line replace the first property line with
set sortedGenreList to paragraphs of (read (choose file))
相关问答
更多-
尝试这个。 代码应该是自我解释的,但如果您需要帮助,请提出问题。 -- get the text from the file set theFile to choose file set theText to read theFile -- turn the text into a list so we can loop over it set theTextList to paragraphs of theText -- put every 3 items into a list and add it ...
-
你非常接近。 在一个数组中是一个项目列表。 所以你可以像访问它: set string1 to array's item 1 -- or set string1 to item 1 of array 或者更好,如果模式永远不会改变,你总是有相同数量的字符串 set {string1,string2,string3,string4} to array 我建议根据他们的内容重新命名你的变量以便更好地理解。 而不是string1我会采取filePath(或其他) you were pretty close. ...
-
试试这个,在iTunes中选择一个或多个曲目并运行脚本。 如果分隔符应该是分号+空格,请更改第二个属性行。 如果类型属性不包含分隔符,则不会更改任何内容。 如果类型与排序列表中的项目不匹配,则将在末尾附加。 property sortedGenreList : {"Rock", "Dance", "Art Rock", "New Wave", "Female Vocalists", "Male Vocalists"} property separator : ";" tell application "i ...
-
这是一个不需要文本编辑的版本。 它将以utf-8编码读取文件,更新其内容并将其作为utf-8编码文本存储回文件中。 我在编写文件时使用try块的原因是,如果另一个应用程序同时打开了具有读取权限的文件,则会出现错误。 如果您想要搜索并替换区分大小写,则考虑的案例块可以围绕集合ti包装到内容的每个文本项目 。 替换字符串时,无需激活它,仅用于查找字符串。 set stringToFind to "replace that" set stringToReplace to "with this" set theFi ...
-
Craig解释的财产的使用是最简单的解决方案。 如果重新编译脚本,将重置属性值。 但是,如果您确实需要将路径值存储在txt文件中以供其他脚本使用,则只需编写该文件,而不是别名,而是字符串: write (theFile as string) to fileReference 当然,稍后阅读文本文件时,请记住它是一个字符串而不是别名! Usage of property explained by Craig is the easiest solution. The property values will ...
-
尝试这个 set t to "this is a string" text 1 thru -2 of t 输出: “这是一个严格的” Try this set t to "this is a string" text 1 thru -2 of t Output: "this is a strin"
-
尝试: set inFile to "/Users/myname/Desktop/URLlist.txt" set myData to (do shell script "sed ' /\\(http[^ ]*\\)/ a\\
' " & quoted form of inFile & " | sed 's/\\(http[^ ]*\\)/\\1<\\/a>/g' ") do shell script "echo " & quoted form ... -
您可以尝试以下方面的内容: set newFolder to POSIX path of (path to desktop as text) & "Found Photos" do shell script "mkdir -p " & quoted form of newFolder set filePaths to paragraphs of (read (choose file with prompt "Select file list") as «class utf8») set fileFolder ...
-
您可以使用文本项分隔符来执行此操作,如果行分隔符字符为\r则将linefeed替换为return set {TID, text item delimiters} to {text item delimiters, "--" & linefeed & date string of (current date)} set counter to (count text items of myDateTime) - 1 set text item delimiters to TID counter将包含出现次数 ...
-
好吧,我想通了,我改变了第二行: set theFile to (POSIX file (theFolder & "Contents/Resources/MyNewDir/MyTxtFile.txt")) Ok, I figured it out, I changed the second line to this: set theFile to (POSIX file (theFolder & "Contents/Resources/MyNewDir/MyTxtFile.txt"))