|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using a mySQL result
I'd like to work with a total from a column in a mySQL table.
ie SELECT SUM(columnname) AS myanswer FROM TableName It seems to work, but how can I print it out on a page I've tried SELECT SUM(columnname) AS myanswer FROM TableName Response.Write myanswer which gets no errors but prints nothing either tried myanswer = (SELECT SUM(columnname) AS myanswer FROM TableName ) Reponse.Write myanswer But not working either How can I gather up the mySQL results to make use of it, either printing it to the page or using it in an IF statement?? Johnie |
|
#2
|
|||
|
|||
|
Sussed it
I know my brain isn't working well today .. Set RS = adoConn.Execute("SELECT SUM(columnname) AS myvalue FROM TableName") Response.Write RS.Fields(myvalue) |
|
#3
|
|||
|
|||
|
As assume you are trying to output things in ASP and not PHP. My ASP days are over but I recall this:
<%= myvalue %> (Same as <% Response.Write myvalue %> Where you like it to be written....in the HTML code on the page. This of course assumes you have a succesful query... |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Using a mySQL result |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|