|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
2 problems
ok i got these 2 problems that ive been working on and i cannot solve. here is the site url HERE
ok my first problem is on that page there. now you see how when you scroll through the prices and it keeps showing you some games over?? well before that code worked for that but that was with a simpler query, when i use inner join it does that for some reason... the code to that page is attached. ok now my second problem is really something i havent used in a while, now you see where the news is posted, well a while ago i used a script in a similar page to shorten it to something like this "this is an example news po......." but havent been able to find that bit of code even tho ive searched the forums and my pc for hours..... <cfif "#FORM.terms#" is "0" and "#session.termsaccept#" is "0"> <cfset "type" = "1"> <cfinclude template="terms2.cfm"> <cfelse> <cfset "session.termsaccept" = "1"> <cfparam name="startrow" default="1"> <cfquery datasource="#datasourcename#" name="mcatlist" blockfactor="100"> SELECT games.ID As MID, games.gamename, games.gameimage, players_prices.ID As CID, players_prices.players, players_prices.price FROM games Inner Join players_prices On games.ID = players_prices.gameid ORDER BY games.gamename, players_prices.players </cfquery> <cfquery name="gameslist" blockfactor="100" datasource="#datasourcename#"> SELECT * FROM games ORDER BY gamename </cfquery> <cfset totalrows = 0> <table width="*" border="0" cellspacing="0" cellpadding="0" class="normal_text"> <cfoutput query="mcatlist" group="MID" startrow="#startrow#" maxrows="3"> <cfquery name="priceselect" datasource="#datasourcename#" blockfactor="100"> SELECT * FROM players_prices WHERE gameid = #MID# </cfquery> <tr> <td width="30"></td> <td> <img src="images/games/#gameimage#" alt="#gamename#" height="120" width="240"> <div class="spacer"> </div> <strong>#gamename#</strong> </td> <td> <table width="*" border="0" cellspacing="0" cellpadding="0" class="normal_text"> <tr> <td width="15"></td> <td>Players: </td><td><cfset "playercount" = "1"><cfoutput group="CID">#players#<cfif "playercount" is not "#priceselect.recordcount#"> | </cfif><cfset "playercount" = #playercount# + 1></cfoutput></td> </tr> <tr> <td width="15"></td> <td height="1" colspan="2" bgcolor="666666"></td> </tr> <tr> <td width="15"></td> <td>Prices: </td><td><cfset "pricecount" = "1"><cfoutput group="CID">#price#<cfif "#pricecount#" is not "#priceselect.recordcount#"> | </cfif><cfset "pricecount" = #pricecount# + 1></cfoutput></td> </tr> </table> </td> </tr> <tr> <td colspan="3" height="20"></td> </tr> <cfset totalrows = #recordcount#> </cfoutput> </table> <table width="90%" border="0" cellspacing="0" cellpadding="0" class="normal_text"> <tr> <td align="left"><cfif "#startrow#" gte "4"> <cfset prevnumber = #startrow# - 5> <cfoutput> <a href="index.cfm?pageid=prices&startrow=#prevnumber#"><< Prev 3 Games</a> </cfoutput> </cfif> </td> <td align="right"><cfset endnumber = #startrow# + 2> <cfif "#totalrows#" gt "#endnumber#"> <cfset nextnumber = #startrow# + 5> <cfoutput> <a href="index.cfm?pageid=prices&startrow=#nextnumber#">Next 3 Games >></a> </cfoutput> </cfif></td> </tr> <tr> <td colspan="2" height="20"></td> </tr> </table> </cfif> |
|
#2
|
|||
|
|||
|
To truncate a string use the left() function.
Your URL did not go through so I can't see the error, but regarding the code that you posted: You may want to try using DISTINCT in your SELECT statement. I know you're new to this, so I'd like to mention that you're violating several best-practices in this code. Just a few that you may want to explore as you learn further:
Hope that's helpful. Regards, Brian
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
||||
|
||||
|
i may be kicking a dead horse here but you're script is very messy man...thats cool if you dont want others that work with u to be able to read it, but for that you should just make custom tags or even CFINCLUDE the good stuff.
Hope that helps...If ive only slighlty annoyed you well then...Too bad. PS. seriously though im serious ![]() |
|
#4
|
|||
|
|||
|
I would have to agree, even if no one else is working on the code, it makes it much easier to debug yourself when its a bit clean, includes are ok but harder to debug though. I usually use indentations:
<cfif ....> <cfquery ....> SELECT ..... </cfquery ....> </cfif ....> It does get pretty long sometimes though ![]() |
|
#5
|
|||
|
|||
|
it didnt show my spaces i put to make it look nice
![]() |
|
#6
|
||||
|
||||
|
oh sorry about that the link to the page is http://www.socgaming.net/newsite/index.cfm?pageid=prices
when you go there click accept in terms and then click "next 3 games" and you will see it shows some games over for some reason..... |
|
#7
|
||||
|
||||
|
also the code is not very messy, its just that this forum took the spaces out....
|
|
#8
|
|||
|
|||
|
Quote:
|
|
#9
|
||||
|
||||
|
yes i did, but it still keeps doing the thing, i think it has something to do with the startrow in the cfoutput tag..... im just not sure what it could be..........
|
|
#10
|
|||
|
|||
|
Unfortunately I don't either because there's no way for me to execute the code. I'd try stripping out all the extraneous code and try to isolate the problem itself (take out the tables, etc.).
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > 2 problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|