arrgh 22 Posting Whiz

I still see the # signs in the content. But also, I the "ids" are messing things up. A view source showed this:

(Header)
<a id="Z" /><a href="#Z">Z</a>
(content)
<tr>
<th valign="top" bgcolor="#CCCCCC"><a name="#Z"></a>Zone Lighting</th>
<td>In dimming, lights that are operated together. Also called Channel Lighting.</td>
</tr>

When I removed the anchor with only an "id":
<a href="#Z">Z</a>

.. and removed the # sign from the content anchor, and used the close shortcut "/", it worked as expected. ie Clicking on "Z" jumped to that section.
<tr>
<th valign="top" bgcolor="#CCCCCC"><a name="Z" /> Zone Lighting</th>
<td>In dimming, lights that are operated together. Also called Channel Lighting.</td>
</tr>

arrgh 22 Posting Whiz

ROFL. Fixed the problem didn't we? Let me look again.

arrgh 22 Posting Whiz

That looks okay. But the anchors I'm talking about are in the content section.

ie
<th valign="top" bgcolor="#CCCCCC"><a name="#R"/>Reflector Lamp (R)</th>
<td>A light source with a built-in reflecting surface.

arrgh 22 Posting Whiz

Oohh... duh! You've got more anchor tags in the page. It's saying you can't use # in the "name" of anchor. Which is true. Because # is used in href only

ie You can't say this:
<a name="#R" />

Because you use it to reference that name in the href
<a name="#R">Go to "R"</a>

It has to be written without the "#"
<a name="R" />
<a name="#R">Go to "R"</a>

arrgh 22 Posting Whiz

Very weird. *Now* I'm seeing the closing tags in view source. An abbreviated version of the page validates fine.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Replacement Light Bulbs : Definitions Page</title>
<!-- TemplateEndEditable -->
<link href="rlb.css" rel="stylesheet" type="text/css" />
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
</head>
<body>
<div id="wrapper">

  <div id="header"><a href="index.cfm"><img src="images/rlblogo.jpg" alt="Replacement Light Bulbs" width="445" height="76" hspace="10" vspace="5" border="0" /></a>
  <div id="search"><form action="http://www.auctioninc.com/cart/"
 enctype="application/x-www-form-urlencoded" method="post"><input
 name="cmd" value="_cart" type="hidden" /><input name="business"
 value="1808" type="hidden" /><!-- View Cart Button --><input
 name="viewcart_btn" value="View Cart" type="submit" />
  
		
</form></div>
  
  <br clear="none" />
  <hr />
</div>

<div id="main">

    <div id="sidebar">
      <ul>

  <li><a href="index.cfm">Home</a></li>
  <li><a href="faqs.cfm">FAQS</a></li>
  <li><a href="http://www.replacementlightbulbs.com/lampscrossreference.html">Cross References</a></li>
  <li><a href="shipping.cfm">Shipping</a></li>
  <li><a href="http://www.replacementlightbulbs.com/policy.html">Policies</a></li>
  <li><a href="terms.cfm">Definitions</a></li>

  <li><a href="contactUs.cfm">Contact Us</a></li>
</ul><br />

<p><strong>Sales:</strong><br />
1-800-692-3051</p>
<p><strong>Technical Support Line:</strong><br />
 1-336-882-2854</p>
<p><strong>Fax Line:</strong><br />
 1-336-882-2819</p>
    </div>

    <!-- TemplateBeginEditable name="mainContent" -->
    <div id="content">
     
      <h2><a id="A" /><a href="#A">A</a><a id="B" /><a href="#B">B</a><a id="C" /><a href="#C">C</a><a id="D" /><a href="#D">D</a><a id="E" /><a href="#E">E</a><a id="F" /><a href="#F">F</a><a id="G" /><a href="#G">G</a><a id="H" /><a href="#H">H</a><a id="I" /><a href="#I">I</a><a id="J" /><a href="#J">J</a><a id="K" /><a href="#K">K</a><a id="L" /><a href="#L">L</a><a id="M" /><a href="#M">M</a><a id="N" /><a href="#N">N</a><a id="O" /><a href="#O">O</a><a id="P" /><a href="#P">P</a><a id="Q" /><a href="#Q">Q</a><a id="R" /><a href="#R">R</a><a id="S" /><a href="#S">S</a><a id="T" /><a href="#T">T</a><a id="U" /><a href="#U">U</a><a id="V" /><a href="#V">V</a><a id="W" /><a href="#W">W</a><a id="X" /><a href="#X">X</a><a id="Y" /><a href="#Y">Y</a><a id="Z" /><a href="#Z">Z</a></h2>


    </div>
    <!-- TemplateEndEditable -->
</div>
  <div id="footer"><br clear="none" />

  <hr />
  <p>Copyright &copy; …
arrgh 22 Posting Whiz

I did a view source, and the tags are nested differently. It doesn't seem to like this:

<a id="A"><a href="#A">A</a></a>

This is okay though
<a id="A"/><a href="#A">A</a>

arrgh 22 Posting Whiz

But notice the difference between that and your original code. In the original the tags weren't closed, which *doesn't* validate. It didn't seem to care much about the # signs.

arrgh 22 Posting Whiz

Well what you posted validates fine. Same 1 warning as mine. So it must be something else in the content.. or maybe it's nested differently in the real code.

arrgh 22 Posting Whiz

Playing around with the validator it doesn't seem to like the unclosed anchor <a> tags. It also didn't seem to like anchors that weren't nested inside some element like a <p> or <div> ...? This validated with 1 warning.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>Test</title>

</head>
  <body>
      <div>
      <a id="A" />
      <a href="#A">A</a>
      <a id="B" />
      <a href="#B">B</a>  
      </div>
</body>
</html>
arrgh 22 Posting Whiz

paulbaylis1

You seem to need a few lessons in learning how to communicate with others. Every one else here managed to remain civil, and take the comments in friendly manner in which they were intended. Except you. While you can certainly express your opinions, you can't tell other people what to do. One would hope your coding skills are not as limited as your social skills appear to be. If not, I don't think you'll have to worry about anyone asking for your advice.

arrgh 22 Posting Whiz

What part? :) Ignoring the startrow/maxRow part, it's just saying "do something every 5th row". Try it with a plain cfoutput and you'll see how easy it is.

<table>
<tr>
<cfoutput query="someQuery">
<td>#CurrentRow# #CurrentRow# #SomeColumn#</td>
<cfif CurrentRow MOD 5 EQ 0>
<!--- close the old row and start a new one --->
</tr><tr>
</cfif>
</cfoutput>
</tr></table>

arrgh 22 Posting Whiz

Taking your eyes and mind off the code for a little while always does the trick ;-)

arrgh 22 Posting Whiz

Unless there's a typo, you're not showing any text in the list ;-)

ie <option>there should be something here </option>

I even tried adding a size attribute.

That applies to vertical size. ie Display x items (or rows). To set the width, use CSS and the "width" attribute. Select lists also have a "width" attribute too. But IIRC it's deprecated.
http://www.blooberry.com/indexdot/html/topics/selectwidth.htm

arrgh 22 Posting Whiz

I'm too brain dead right now to explain it well. But most techniques use the MOD operator to determine when to create a new row. ie if the current index is divisible by 5, create a new row

<cfif CurrentRow MOD 5 EQ 0>
<!--- close the old row and start a new one --->
</tr><tr>
</cfif>

BUT ... since you're using startRow/maxRows your #CurrentRow# won't start at 1. So you'll probably need to create your own row counter instead.

arrgh 22 Posting Whiz

Yeah, I know a little of both too. I think they've all got different strengths and weaknesses. I find the hard part is forcing myself to use the conventions of whatever language I'm in. In other words, not writing php code the way I'd write CF code or .net code. Because each one may have a totally different conventions or ways of doing things. So you can easily miss out on some features or strengths of that language ;-)

arrgh 22 Posting Whiz

I don't know if CF9 supports the 2007 format out of the box (ie .accdb).
http://blog.crankybit.com/msaccess2007-and-cf8/

I'd try using an .mdb file first. It should be simple.
1. Log into the CF Admin => Data & Services => Datasource
2. Add a DSN
* Enter whatever name you want in the "Datasource" text box.
* Select either "Microsoft Access" or "Microsoft Access with Unicode" from the "Driver" list
* Click [Add]
3. On the next screen go to the Database File box, and click the "Browse" button to locate your .mdb file. Select the one you want. Finally click "Submit" to create the datasource.

If everything goes well, the datasource should be created and the Admin will return to the list of DSN's. The one you just created should show an "OK" next to it. To show it's working.

If it helps, see this article. You should only need the options described above. But the screenshots might help. Note, it's for MX6 so it won't look exactly the same as CF9
http://www.peachpit.com/articles/article.aspx?p=29452&rll=1

arrgh 22 Posting Whiz

Well I enjoy learning other languages (and walking too). Though they often make me appreciate the elegance of CF all the more ;-)

arrgh 22 Posting Whiz

If it returns blank, it means they got to the page directly (user was not taken to it via a URL).

.. or that value is blocked by firewall s/w.

arrgh 22 Posting Whiz

If you're trying to do pagination (be it 1 item per page or 10), this seems like the wrong approach ie too complicated. Do a search on +ColdFusion +pagination. There's plenty of working examples.

arrgh 22 Posting Whiz

I want the position eg 7th row, of the only one returned row,

It's still not making sense.

How can there be 7 rows in a query that only returns 1 row? Why do you need to know the row position? ie What are you using it for

arrgh 22 Posting Whiz

The query is already filtered by a Product_ID. So it's not clear what value are you referring to.

If you could explain why you need to determine the row number, and what db you're using we may be able to suggest a better option.

arrgh 22 Posting Whiz

Man i cant believe it was that easy. thanks again

It's always easy... once you know the answer ;) Anyway, glad to help.

arrgh 22 Posting Whiz

<cfif #URL.get#> or <cfif isDefined(URL.get)>

First and foremost, you have to make sure that variable is defined before using it. In the current code, you're checking the value 1st, then seeing if it's defined. That's probably why you're getting an error. Solution: your IsDefined() statement must be first.

Second, IsDefined() works a little different than other functions. You need to pass it the name of a variable - in quotes. If you don't put it inside quotes, CF assumes you want to evaluate that variable and you get an error. It should be like this.

<cfif IsDefined("URL.get")>
    do stuff here ...
</cfif>
arrgh 22 Posting Whiz

Ok so if I set them to varchar instead of char, then I can delete the maxLength in my sql queries? Since varchar is variable length datatype, and the maxlength is set to
255, that kinda nullifies the varchar type correct?

Yes and no. Varchars can have different limits in different dbs. In MS SQL 2005, the limit is 8000. So just because the limit is 255 in your db, doesn't mean CF knows that.

Using maxLength means CF will check the value's length before sending anything to the db. If it's too long CF will throw an error. If you DON'T use maxlength, CF will just send the value straight to your db,. If the string ends up being too long, you'll probably get a db error.

So if you're going to get an error either way, what's the difference? ;) Personally I think it's better to use maxLength. Then CF doesn't even bother attempting the db query if the value is too long. Translation: One less db query. Of course in reality it wouldn't happen that frequently, because you normally validate this kind of stuff on the client side first.

arrgh 22 Posting Whiz

Not sure about performance diff's with type CHAR. Like I said I rarely use it. But you should definitely understand how/if it will effect your queries. I tend to use CHAR only when I know the value will _always_ be a specific length. Otherwise, it makes more sense to use VARCHAR (variable length character ;-)

As far as very large fields, yeah you might need to select a larger type than varchar. But that wouldn't apply if you're limiting it to 255 characters. That's the one I was talking about. For values that might be _much_ larger, then yeah - TEXT would be appropriate. Though you should probably use cf_sql_longvarchar for them.

Maybe I should go back and rework some of these and change them.

Yeah, and make sure you've matched up the cfsqltypes correctly. While the wrong types might work too, you may as well use the right ones. Then you get the benefit of whatever type checking CF does in the background.

arrgh 22 Posting Whiz

Hmm... I'm confused about your column types.

most of them are now char type.

You mean literally CHAR type (not VARCHAR)? Just curious.. but why? I tend to use it sparingly ;) Mainly for single characters codes. CHAR fields can behave differently than VARCHAR when it comes to white space. I constantly forget that. Then end up driving myself crazy trying to figure out why some query isn't behaving the way I think it should.

also set item as text because its not my primary key

You mean the literal type TEXT (ie really big field)? That doesn't really make sense if you're going to limit it to 255 characters. At least I think that was the limit in your cfqueryparam.

I'm not sure about the data type choice for the other fields either ;)

arrgh 22 Posting Whiz

I'm sure we'd all find something else to do with our skills and time. Not that it's likely to happen any time soon ;-)

arrgh 22 Posting Whiz

Now if only they'd put all that energy and creativity towards good things, what a wonderful world it'd be ;-)

arrgh 22 Posting Whiz

didnt think I had to do that when the query was just a user defined search against the database. No data is being entered into the db

Any time you're running sql against a db that uses user-supplied info, you should use cfqueryparam. Even with SELECT statements, crafty users could append bad stuff to the variables and make it do bad things.

arrgh 22 Posting Whiz

Good. Just be sure to use the correct types or you'll have other problems. I doubt all of your columns are VARCHAR ;-) ID columns are probably integers, or some numeric type. Btw: What type is "keywords" ?

cfqueyparam data types
http://livedocs.adobe.com/coldfusion/8/Tags_p-q_18.html#1102474

arrgh 22 Posting Whiz

Those are two totally different things.

CFPARAM sets a default value for a variable if it doesn't exist (with optional type checking).

CFQUERYPARAM is used only inside cfqueries. Though not it's main function, it does indirectly help prevent sql injection by using bind variables and enforcing stronger type checking. Neither can be achieved w/cfparam. You just have to use cfqueryparam .. and use it everywhere! ;-)

<cfquery name="rsDetails" datasource="rlbulbs">
SELECT ... FROM ....
AND a.item = <cfqueryparam value="#URL.item#" cfsqltype="cf_sql_integer">
</cfquery>

arrgh 22 Posting Whiz

I cant believe you'd suggest that!
lol
umm no, MySQL why??

I know. It's terrible. But you're not using cfqueryparam :P Whatever you might say about MS Access (and I could say a lot) AFAIK it's not vulnerable to cfquery sql injection the way other db's like MySQL are.

arrgh 22 Posting Whiz

AND a.item = #URL.item#

I hope you're using MS Access ....

(I can't believe I actually said that)

arrgh 22 Posting Whiz

It can be confusing at first. Keep in mind there's different ways you can call functions, and reasons why you'd use 1 way versus another way. But let's ignore that for now and get back to your question.

In order to use the function, you have to create an instance of the component first. The simplest way to do that is using CFINVOKE. The "component" value is normally a dot-notation path to your component. But if both your files are in the same directory, you can just use the component name: ie "_component" without the .cfc extension. Use "returnVariable" to capture the results of your function.

<cfinvoke component="_component" 
          method="myFunction" 
          myArgument="some value here"
          returnVariable="result" >

BUT ... you could also call it like brettskiii showed in the previous post. You could also call it a 3rd way (my personal preference). I find it less bulky:

<!--- create an instance of the component --->
<cfset myObj = createObject("component", "_component")>
<!--- then call the function --->
<cfset result = myObj.myFunction( "some value here ")>

For uber-clarity you could use the argument names when you call the function. But it's not strictly needed here.

ie <cfset result = myObj.myFunction( myArgument="some value here ")>

Anyway, those are the 3 main ways you can call a function within a component

arrgh 22 Posting Whiz

Some of the answers looked promising to me. Basically what I'd suggest. If they didn't work for you, did you ask the people that suggested them follow-up questions?

arrgh 22 Posting Whiz

Not to be rude, but wasn't this already answered on like 2 other forums?

arrgh 22 Posting Whiz

(UK - dd/mm/yyyy

This is an old thread.

But for anyone reading, the most important problem is the date format. CF assumes US date format by default. So while you think you're passing May 4th (4/5/2010), the date you're actually passing is April 5th! Use LS date functions to interpret the date string properly.

Once that is corrected .. then you can figure out what else is wrong with the sql ...

arrgh 22 Posting Whiz

If nothing else it makes me feel better about times when I've done that myself ;)

arrgh 22 Posting Whiz

Well you're talking about a totally different error now. It sounds like a db error. I can't see the query code from here ;) But with datasources it could be anything from missing permissions, wrong user account used to connect, to a datasource pointing to the wrong db.

arrgh 22 Posting Whiz

Well I think I figured out after the posts you, arrgh, and Shalinko posted. I didnt have a <cfset SESSION.login = "No"> on my adminLogin.cfm template

But you shouldn't have to! That's the whole point of using CFPARAM. It sets a default for a variable only if that variable doesn't exist ;-) As long as your other page is in covered by your Application.cfm, it should work without having to set the variable manually.

Sorry. I don't use DW.

arrgh 22 Posting Whiz

Where are you setting the session variables? I'd also check the obvious things like is sessionManagement enabled in the application.cfm/cfc.

IIRC, there used to be an issue with setting session variables and using cflocation on the same page. Don't know if it still applies though.

arrgh 22 Posting Whiz

No, but there's lots of threads about recommendations on both adobe's forums and www.houseoffusion.com

arrgh 22 Posting Whiz

Thanks for the updates. Glad to see things are progressing. I'm surprised about the cause though. The "maintain connections.." setting caused problems in CF8, though IIRC it caused a null pointer error or something. But thought they fixed that. Guess not!

arrgh 22 Posting Whiz

They said they had noticed some spikes in the server logs

Is that code for ".. we saw bunches of errors in the logs and realized it might not be your code at fault but our networks and/or hardware"? ;-)

arrgh 22 Posting Whiz

Yeah, I don't know about moving someone else's db without their permission. But more importantly, why did they suggest that and what issue did they think it would solve?

arrgh 22 Posting Whiz

Sporadic errors are always the hardest to work through with any tech support dept. You should document it when it happens again (time, script, etc..) and definitely take a full screen shot!

arrgh 22 Posting Whiz

I hate godaddy!

From the many threads and blogs I've read .. you're not alone there.

arrgh 22 Posting Whiz

Yes, that's why I'd sift through the google threads on those phrases. You're obviously not the 1st person to have the problem. So there might be an answer somewhere in them. That's what I always do when I have a weird problem I can't solve. Find similar threads and see if someone found a fix for it ;)

arrgh 22 Posting Whiz

>>> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'rlb'

The first one looks like a wrong database name. The others seem like some kind of network problem. Not sure if it's network or driver related. But google shows lots of threads on these two phrases.

1.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

2.
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

arrgh 22 Posting Whiz

Always jump to the end 1st ;)