Jump to content

LLLLLLL

Members
  • Posts

    306
  • Joined

  • Last visited

Posts posted by LLLLLLL

  1. Now your code will reference the i from the function.

     

    However, why aren't you doing all this work when the table's data is being collected server-side? That'd be a heck of a lot better than using AJAX.

     

    Yes, the code now works. Can you explain what your function(i)... syntax actually means? I'm unfamiliar with that. (I do far more server-side work.)

     

    ... when the table's data is being collected server-side...  what do you mean by this statement?

  2. I'm trying to loop over a table, make an ajax call per row, and get the result back and update the HTML in a cell of the row. I don't know why this isn't working:

     

    		// start at row 1 because row 0 is the header row.
    		for ( i = 1; i < tbl.rows.length; i++ )
    		{
    			row = tbl.rows[ i ];
    			email = row.cells[ 1 ].innerHTML;
    
    			$.get( "includes/ajaxfile.php", {					
    				em: email,
    				id: someValue },
    				function ( data ) { 
    					id = "#status" + i;
    					$( id ).html( data );       
    				}
    			);
    		}

     

    The result I get is that only the "status" of the last row is ever updated. Attempts to debug are difficult; sometimes "i" shows a value of 3, which is impossible because the table has only three rows, and the for loop should prevent that.

     

    I might be overlooking something simple. Thoughts?

  3. I have release notes on my server, at example.com/release.txt. My software points to this file so people can see the notes:

     

    file_get_contents( http://example.com/release.txt );

     

    Why -- since all sites are on the internet -- can most of my customers see the file but some cannot? Just seems odd to me. Could some servers be turning that off or something? Doesn't seem like a problem on my server.

  4. You clearly have no idea what I want to accomplish. And yes, the form goes to index.php?category=blah. I'm not sure why you're being so unhelpful.

     

    Let's say wikipedia had a select box with choices of Hydrogen, Helium, and Oxygen. I want the form to take me to one of these.

     

    http://en.wikipedia.org/wiki/Hydrogen

    http://en.wikipedia.org/wiki/Helium

    http://en.wikipedia.org/wiki/Oxygen

     

    How would I create a form that does this? This has been my question all along. There are no get parameters in those URLs; how would you do it?

     

    I think my javascript method is the only answer.

  5. Bear with me on the description here....

     

    I have a pretty standard form with a select box:

     

    <form method="get" action="index.php">
    <select name="category">
    

     

    So this creates a URL like "index.php?category=123". All is well and good.

     

    To make the category pages more SEO friendly, I'm trying to eliminate the "index.php?" part of the url, and just have category=123. I know how to make .htaccess do a back-side redirection of category=123 to index.php?category=123.

     

    My question is, is there a way on the form to make submission of the form go to category=123 instead of index.php?category=123 ?

     

    I think the only method is to change the submit button on the form to be a javascript function (as opposed to a form submit button) that manually determines the URL to visit by concatenating the get parameters and opening the page. I don't know if there's a way to do this within a standard form/submit type of method.

  6. So I have a website that that includes resources in the header, for example:

     

    css/styles.css

    js/someJavaScript.js

    js/AnotherJavaScript.js

     

    Everything works fine; let's say the url is example.com/store/something.php.

     

    Using .htaccess, I'd like to redirect a virtual URL, say, example.com/ABCD to example.com/store/something.php. The redirection works fine (it's a virtual redirection; keeping example.com/ABCD in the address bar just like Wikipedia does, for example) but none of the resources display because it is ultimately looking for something relative to the virtual directory.

     

    Is there a way to make the resources -- and I guess images and hrefs on the pages, if possible -- always link using the original path? Obviously I could hard-code all URLs, but I'm wondering if there is a simpler, more elegant solution.

     

    Thanks!

  7. I realize the source shows those are entities, but that's not what the GET array is giving me.

     

    Standard unescaped query:

    SELECT * FROM products WHERE name = 'Product Name 'with single quotes' " B'

     

    Standard error

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'with single quotes' " B' LIMIT 0, 30' at line 1

     

  8. The source of the page shows:

     

    raw: Product Name &#039;with single quotes&#039; " B<br>mysql_real_escaped: Product Name &#039;with single quotes&#039; " B

     

    The only problem is that there are not backslashes in this string; I get the normal mysql error. I'm really just concerned with why I'm not getting the backslashes to escape the string.

  9. Never had this one before.

     

    Here's a string from a URL:

    $urltext = Product_Name_'with_single_quotes'_"_B

    $name = str_replace( "_", " ", $urltext );
    echo 'raw: ' . $name . "<br>";
    $name = mysql_real_escape_string( $name );
    echo 'mysql_real_escaped: ' . $name . '<br>';
    

     

    Doesn't seem possible, but both of the "echos" return the same string. My query fails because there are no backslashes in the SQL statement. What's going on here?

     

    raw: Product Name 'with single quotes' " B

    mysql_real_escaped: Product Name 'with single quotes' " B

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.