hey!
I am after some good example if any of searching a localhost mySql db.
Basically what I am after is I want to build a small application that has several input fields and probably a couple of other options etc radio buttons etc that I can fill in then on press of a button it searches a specific database and then displays the results within a window on the application.
I can produce this easily in xhtml or flash easily, but would really like to make this look professional and an application and on a mac, for my final year project
I hope this makes sense so if any one knows of of ways or tuts etc this would be great.
Much appreciated for the kick in the right direction.
Hers a quick layout built in builder that I am after and no clue. Cheers
Click to view image
You just need to learn the command line syntax for accessing your database. The Command Line Help Page from MySQL is a good source, and you will also find some useful information in this thread.
Post another question if you need more assistance.
thanks craig will have a look and no doubt there will be questions
thanks craig that was great I tried the following code that you mentioned on the links and after changing the relevant info, it worked and displayed what ever I asked in the dialog box in scripter etc
set the_table to "drivers"
(do shell script "/usr/local/mysql/bin/mysql -u root " & " -D " & "'test'" & " -e \"" & "SELECT * FROM " & "\\`" & the_table & "\\`" & "\"")
cheers craig,
Now my next task is learning how to attach to a builder interface that I showed in the image and that so any one with easy to follow tuts around there on how to:
Interact AS with Interface builder
How to script an text input into a variable to enable db search etc
How to set a record or even a one bit from a record to a variable. ie record has say “id, name, contact” then assign the selected search result etc to a variabel eg myName
for ie set myName to “name”
Much appreciated. I did find a really nice idiots type guide to AS a while back but lost it. Thanks guys.
Si
Model: iBookG4
AppleScript: Xcode 2.4.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
When you send a SELECT to MySQL, you need to know what format is coming back. For instance, in this case, we are expecting two pieces of data from one record (artist and artist_id). The raw data would look something like this:
{"Brad Wolfe 56"}
But, we want a two item list with these things, so we use text item delimiters to separate them. MySQL sends each record with a tab between the items, so we use this handler:
on FindExact(search_string)
set b to do shell script ("/usr/local/mysql/bin/mysql -u root " & " -D " & "'dvd2sql'" & " -N -e \"" & "SELECT artist, artist_id from artist where artist = " & "'" & search_string & "'" & "\"")
set {astid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, tab}
set c to b's text items
set AppleScript's text item delimiters to astid
return c
end FindExact
FindExact("Brad Wolfe")
-->{"Brad Wolfe", "56"}
Is this close towhat you are looking for?