As other users have noted, the third and fourth bullet points are probably not worth holding on to, as it makes the first two difficult to implement:
use S : application "Safari"
property PHPMyAdminURL : "http://xxxxx/ppmya"
if S is not running then return openPHPMyAdmin()
set _T to a reference to (every tab of every window of S whose ¬
name contains "PHPMyAdmin" and ¬
URL contains "/ppmya")
if (count _T) > 0 then return viewPHPMyAdmin(_T)
if (count windows) = 0 then
make new document with properties ¬
make new tab at end of tabs of S's window 1 ¬
with properties ¬
set current tab of S's window 1 to the result
set [T] to T
set W to the first window of S whose tabs contains T
set current tab of W to T
set the index of W to 1
After some initial feedback from @user3439894, I removed the
on quit handler as trying to use the script as a stay-open application prevents item 2 from being effectively implemented.