currently we query our MySQL database for a cellphone #
(stored in users/cellphone) and set the value of a variable (phone)
fromUser = getRecordset(“select firstName from Users where idUser=” & session(“idUser”))(“firstName”)
toUser = getRecordset(“select firstName from Users where idUser=” & idUser)(“firstName”)
phone = getRecordset(“select cellphone from Users where idUser=” & idUser)(“cellphone”)
I would like the dim phone
to be set to TWO numbers from the DB in the format [“cellphone”,“phone”]
I can’t seem to get the query select to return the two fields (and then separate them with a comma).
For mysql, you could use ‘CONCAT’ to merge fields / text together to pass them out as a comma seperated list, CONCAT(field1, ', ', field2)
Equally, it’d be more efficient to pull all the data in one go rather tahn 3 (or more) seperate queries to the database.
realized I was working with an ASP page that does the MySQL query and then passes the results to an external PHP script. Here’s how I solved it.
cellphone = getRecordset(“select cellphone from Users where idUser=” & idUser)(“cellphone”)
homephone = getRecordset(“select homephone from Users where idUser=” & idUser)(“homephone”)
Response.Redirect(“SendSMS.php?no=”&cellphone&“,”&homephone [/INDENT]Not as elegant as a concatenation, but it works.
Thank you for your help!
Why not do away with the ASP script, and do all of that lookup in the PHP script?
The website and most of its functions were written in ASP. This part of what we are doing is an add-on to a [classic] asp form submit page that calls an exisitng classic asp function which saves some data to the DB and then runs a query on the DB and sends an email…
With this PHP script we are adding the ability to also send an SMS txt msg.
Long term, we’ll convert the entire site and all of it’s functions to PHP… but for now, all we want to do is add the SMS functionality.
(All of this would have been unnecessary if people under 30 would have stuck with email instead of using FB messaging and texting!! hehe)