Jump to content

adam84

Members
  • Posts

    289
  • Joined

  • Last visited

Posts posted by adam84

  1. I have two Databases(user, products),

     

    1: users(userID, userName) - deals with all the user stuff

    2: productInformation (purchaseID, productID, userID )- deals with products and customer purchases

     

    What I am trying to do is organize all the products by userName.

     

    This is what I have:

    SELECT 
                   p.purchaseID, p.productID, u.userName
    FROM  
                   products.productInformation p, user.users u
    WHERE
                   p.userID = u.userID
    ORDER BY  
                   u.userName
    

     

    But this doesnt work? any ideas?

  2. I have a textfield where the user enters a keyword about whatever they are looking for. I send the data to my php file to be processed and what I want to do is highlight the keyword that the user entered in, when I display the all the results that have matched the keyword.

    What I did was use the str_replace() function, but what I have noticed is the function is case sensitive. So if the user enters 'beer'. Only the word 'beer' will get highlighted, but 'Beer', 'beeR' or 'BEER'. What would I need to do, to make it work on every instance of the word.

  3. instead of displaying:

     

    echo '<p><b>Success!</b></p>';   
            echo '<span>Your registration was successfully processed. You may login and start using your account. Thank you for registering !</span>';
    

     

    use redirect("Location: members.php");

  4. Straight forward Ajax

    - every other ajax call works fine

     

    function sendRequest(act,divtag) {
    http.open('get', act); 
    http.onreadystatechange = openRequest; 
    divhandler.divtag = divtag; 
    http.send(null); 
    } 
    function sendLog(act,divtag) { 
    http.open('get', act); 
    http.onreadystatechange = openLog; 
    divhandler.divtag = divtag; 
    http.send(null); 
    } 
    

     

    Function where the error occurs in

     

    function submitReview( pID, back, fromGoto ){
    var errors = ''; var concat = '';
    
    // I deleted the data validation checks
    
    if( errors != '' )
    	document.getElementById('reviewErrorID').innerHTML = '<FONT COLOR=red>' +  errors + '</FONT>';
    else{
    	document.getElementById('reviewErrorID').innerHTML = '';
    
    	var div = 'searchDIV';
    	if(fromGoto>0)
    		div = 'contentDIV';
    
    	var str  = 'insertReview.php?';
    	    str += 'pID='+pID;
    	    str += '&title='+encodeURIComponent(title);
    	    str += '&gender='+gender;
    	    str += '&weight='+weight;
    	    str += '&height='+height;
    	    str += '&bf='+bf;
    	    str += '&pros='+encodeURIComponent(pros);
    	    str += '&cons='+encodeURIComponent(cons);
    	    str += '&supps='+supps;
    	    str += '&back='+back;
    	    str += '&fromGoto='+fromGoto;
    
    	sendRequest(str,div);
    }
    }
    

     

    The pros/cons variables can hold upto 1000 characters.

     

    This function works fine if:

    - I comment out the sendRequest(str,div); line

    - both pros/cons have under 400 characters

     

    This function gets an error if:

    - both pros/cons have over 400 characters

     

    The error I get when I submit the page is 'The system cannot locate the resource specifed'.

  5. Straight forward Ajax

    - every other ajax call works fine

    function sendRequest(act,divtag) {
    http.open('get', act); 
    http.onreadystatechange = openRequest; 
    divhandler.divtag = divtag; 
    http.send(null); 
    } 
    function sendLog(act,divtag) { 
    http.open('get', act); 
    http.onreadystatechange = openLog; 
    divhandler.divtag = divtag; 
    http.send(null); 
    } 
    

     

    Function where the error occurs in

    function submitReview( pID, back, fromGoto ){
    var errors = ''; var concat = '';
    
    // I deleted the data validation checks
    
    if( errors != '' )
    	document.getElementById('reviewErrorID').innerHTML = '<FONT COLOR=red>' +  errors + '</FONT>';
    else{
    	document.getElementById('reviewErrorID').innerHTML = '';
    
    	var div = 'searchDIV';
    	if(fromGoto>0)
    		div = 'contentDIV';
    
    	var str  = 'insertReview.php?';
    	    str += 'pID='+pID;
    	    str += '&title='+encodeURIComponent(title);
    	    str += '&gender='+gender;
    	    str += '&weight='+weight;
    	    str += '&height='+height;
    	    str += '&bf='+bf;
    	    str += '&pros='+encodeURIComponent(pros);
    	    str += '&cons='+encodeURIComponent(cons);
    	    str += '&supps='+supps;
    	    str += '&back='+back;
    	    str += '&fromGoto='+fromGoto;
    
    	sendRequest(str,div);
    }
    }
    

     

    The pros/cons variables can hold upto 1000 characters.

     

    This function works fine if:

    - I comment out the sendRequest(str,div); line

    - both pros/cons have under 400 characters

     

    This function gets an error if:

    - both pros/cons have over 400 characters

     

    The error I get when I submit the page is 'The system cannot locate the resource specifed'.

  6. 1. try this to check if your radio button is selected

    var r = document.getElementById("AnimationChoice");

      var counter;

      for (counter = 0; counter < r.options.length; counter++) {

        if (r.options[counter].selected ) {

          alert(r.options[counter].value);

          break;

        }

      }

     

    2. Something I found by putting id instead of name, it solved the problem. No 100% sure, try it

    <td><input type=radio id="AnimationChoice" checked value="u0001">u0001</td>

    <td><input type=radio id="AnimationChoice" checked value="u0002">u0002</td>             

    <td><input type=radio id="AnimationChoice" checked value="u0015">u0015</td>

     

     

  7. I have a page where the user can fill out information and there are two textareas where the user can enter up to 1000 characters in each textarea. If i put in a message about 200 characters long for each, everything works good. But if i enter 1000 characters in each textarea, i keep getting the same javascript error: 'The system cannot locate the resource specifed'. Do anyone know whats up with that???

  8. Probably the only way of doing this is using the Javascript to run a function every 1sec, then have the JS function use ajax to call a php file which you can check to see if there is any new update. Then load whatever you found into a div or span tag on your page.

     

    JS file

    function checkMessages(){
    
    sendRequest('checkNewMessages.php','newMessages');
    
    setTimeout("checkMessages", 1000);
    // Param 1 = "checkMessages" will call this function
    // Param 2 = 1000 milli = 1 sec
    }
    

     

    PHP FILE

    do whatever you need to do
    

  9. Still no like. This is what is going in:

     

    Used PHP to write JS

    echo "Function validate(){"
       //i took out all the validation tests and stuff
      echo "sendRequest( encodeURI('insertTitle.php?title='+title), 'result' );";
    echo "}"
    

     

    I enter the text '100% Me? & You' and submit it

    the url being passed is: insertTitle.php?title=100%25%20Me?%20&20You

     

    my php file to process the data

    <?
    $title = $_GET['title'];
    echo urldecode($title);
    ?>
    

    result of this is: 100% Me?

     

     

  10. I was wondering if it will cause a problem if the user enters some text like:

    'I got 100% on my test & 85% on my assignment. What did you get?'

     

    would the %, ? and & signs cause a problem with the data being sent? Is that a function that I should use to get around this...?

     

    Thanks

  11. I am using ajax, so I am manipulate the text with either php(prefer) or javascript.

     

    I have a text area where the user enters whatever. They click send and a 'js' function gets called and it calls my sendRequest function and sends over the data to my php file to be insert into my db.

     

    What I want to do is remove any of the html/js tags I can. The only thing I want to keep is the spacing the user enters (line spacing).

     

    My php file - I have tried many different ways, but none of them seem to work

    
    $txt = $_GET['text'];
    
    $stuff = array("\n","\r");
    $txt = str_replace($stuff, "<br />");
    echo strip_tags($txt, '<br />');
    
    

     

    So using the code above if I enter:

    <b>Test</b>
    
    This is a test
    

     

    The Results is:

    TestThis is a test

     

    I've tried another method using 'preg_match', but i am getting an error b/c of the function.

    by the way i am using php 4.4.4

    Any ideas what is going on???

     

  12. I dont know if this would be a php,html or mysql question, so i tried here furst. I have a textarea where the user enters whatever. Once the user is done, he/she clicks the send button and through ajax the textarea value gets sent to the php file to be process.

     

    The problem is:

     

    Say the user enters this in the textarea

     

    Hello World!

     

    This is a test!

     

    I insert that value into my db. But when I retrieve the value the carriage return is not there.

    I looks like this: 

     

    Hello World!This is a test!

     

    What is the problem

     

     

     

     

×
×
  • 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.