Results 1 to 8 of 8

Thread: Problem to store data in mysql through PHP with javascript and ajax

  1. #1
    Join Date
    Nov 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem to store data in mysql through PHP with javascript and ajax

    Hi!
    First of all i beg your pardon for my bad english. It isn't my native language. Second, i don't know really what the problem is. I assume it's a PHP problem but it could be something else. So this could be in the wrong forum.
    Ok, i try to explain my problem now *sigh*

    The user comes through my login pages to startseite.php. There is a menue where he can choose Kunden -> neu. This opens a new site k_neu.php into an other div (ajax container) some lower to the menu which still remains visible. There he can input some data, k_neu.js checks the data and then the php should send the data to the mysql db but nothing happens. I tried the sql-statement in the mysql console and it works. So, its not a sql problem. I'm a beginner in web-coding so i don't know what to do. Firebug tells me only warnings (which are unfortunally pretty normal in web-coding as i learned so far...) and no real errors. The apache2 log file tells me something about php which i can't understand.

    I post my code on pastebin because .php is not a valid extension.
    startseite.php : http://pastebin.com/mGv4wHsB
    The css to see the page properly:
    style.css : http://pastebin.com/dB98FBhq
    k_neu.php : http://pastebin.com/9XDMPWx1
    k_neu.js : http://pastebin.com/6kGAV6G5
    From apache2:
    Default apache2 error log : http://pastebin.com/WVqK9nBn
    apache2 error log of the vhost which i use : http://pastebin.com/4yhLCREe
    And there is the ajax code which i use:
    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    I hope this is enough to make my problem clear and that here is someone with a purpose to fix it.

    Regards,
    Joe

    EDIT: Ignore the screenshot. I didn't know that ksnapshot makes such useless small screenshots despite fullscreen was selected and i don't know to remove the file in the upload manager.
    anyway, firebug has this 2 warnings:

    TypeError: function ajaxpage does not always return a value
    function ajaxpage(url, containerid){
    startseite.php (line 46)

    and

    ReferenceError: assignment to undeclared variable i
    for (i=0; i<arguments.length; i++){
    startseite.php (line 80)

    This is how it looks like while browsing through the menu:
    http://img821.imageshack.us/img821/3...hirmfoto3h.png
    http://img696.imageshack.us/img696/4...hirmfoto4s.png
    And this after i hit 'speichern' to send the data to the mysql db.
    http://img826.imageshack.us/img826/9962/afterc.png
    No, error at all. Just a ajax warning and no data at the tblKunde table.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Bildschirmfoto3.jpg 
Views:	968 
Size:	16.7 KB 
ID:	4821  
    Last edited by JoeBlack; 11-03-2012 at 04:25 AM. Reason: screenshots

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,634
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Your error log doesn't match up with the PHP scripts you posted - line numbers, etc. don't match. Are you sure that's the complete, correct script? I'll look at everything a bit more later today.

  3. #3
    Join Date
    Nov 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry, i should have cleared the log file before i posted. I just copied the last entries. I stopped the apache, cleared the log file, restarted it, and reproduced the process on the web page. After that the vhost error log was (surprisingly) empty and only the (default) apache2/error_log had this 2 lines: http://pastebin.com/eeLs2R0v

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,634
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You should remove your DB credentials from your pastebin posts.
    You should never post passwords, usernames, or other sensitive information online.
    You should obfuscate them in your posts (for example, replacing "password" with "********").


    Is k_neu.js a plain javscript file, or is it generated by PHP?

    What I'm getting at is this:
    Code:
    document.form1.action = <?php $_SERVER['PHP_SELF']?>;
    Is that what it actually says in your script, or does it show the correct URL?


    *****
    Talk to your web host about the Init warning (I doubt it's related to this problem, but it should be dealt with).

  5. #5
    Join Date
    Nov 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I know about the sensitive password publishment but the page is far form being online and i will change all passwords/hashes/rights/etc. when my project is final. Anyway i will do what you said and make the passwords irrecognizable.
    k_neu.js a plain javascript file. Solid and not generated. The code is equal to the code in the file. Line 31,32,33 was a try to fix the problem but it didn't work. The result is the same with or without these 3 lines. What do you mean with 'Init warning'? The server of the website is a virtual machine (suse linux 12.2) running apache2 and i have full control over it (root).

  6. #6
    Join Date
    Nov 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Shall i start a 'DD scripts Paid Help' thread or a 'General Paid Work Requests'? How much is the usual price?

  7. #7
    Join Date
    Mar 2011
    Posts
    2,171
    Thanks
    61
    Thanked 121 Times in 117 Posts
    Blog Entries
    4

    Default

    If you're looking for paid help, post in the General Paid Work Requests forum.
    The DD scripts Paid Help forum is for paid help concerning the scripts found on Dynamic Drive.

    The price is completely up to the developer.
    Post there and people should be able to give you a quote (if they want to take the job).

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Note: you can also post a price of your choosing (and say whether is it or is not negotiable). It's your choice. I'd say usually the developers set the price, but that's not a rule.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. How to Store/Edit/Retrieve Central Data for Free?
    By Alice Moore in forum Looking for such a script or service
    Replies: 2
    Last Post: 07-14-2010, 09:10 AM
  2. store php and html in mysql
    By sarahmx in forum PHP
    Replies: 5
    Last Post: 02-22-2010, 08:44 PM
  3. Problem with getting data from mysql
    By jaffyy in forum Looking for such a script or service
    Replies: 12
    Last Post: 11-18-2007, 01:42 PM
  4. Replies: 8
    Last Post: 09-29-2007, 09:26 AM
  5. Problem with storing data in MySQL
    By costas in forum MySQL and other databases
    Replies: 1
    Last Post: 08-21-2006, 02:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •