FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


some AJAX/PHP problems...





alalex
Im posting here my two problems at this moment with php and AJAX... yes, they are 2.. Sad

1-
I want to have on the register form, that thing that displays a loading circle, and then it displays if the username is taken or not.
Right now I am using a code I found in this web: http://www.shawngo.com/gafyd/index.html
It works for them, so I thought that it had to be right!
But they use a csv file, I dont, I use a MySQL database, what i dont knwo is if it matters! I have checked my check.php file using a form to post the username, and it worked, it echo's in a span the result.

But it is not working!
Here is the url: http://kdams.es/register.php

If you know of a better way of achieving this other than the one I am using please comment! and of course i'd be really reateful if someone could correct the current code!

2-
I would like to add a progess bar to the photo upload system, and I have found the jQuery plugin that will do the trick (http://digitalbush.com/projects/progress-bar-plugin)
Now the thing is, they use a timer for the progress bar, I want to display the real progress, but I really dont know how to have javascript know how much it will take php to upload the pic!
Any help will be really appreciated

thanks! Wink
woodenbrick
Have you made the changes to check.php so it is not looking for the csv file.
Firebug gives me the error updateName is not defined after I type a name into the Nombre box, not sure how helpful that is...
Your check.php should look something like this:
Code:

<?php
$username = trim(mysql_escape_string(($_POST['username']));
echo check_username($username); // call the check_username function and echo the results.

function check_username($username){
   //make sure you have connected to mysql and selected db
   $username=strtolower($username);
   $result = mysql_query("SELECT * FROM users WHERE username ='$username'")
   or die(mysql_error());
   if(mysql_num_rows($result) > 0){
      return '<span style="color:#f00">Username Unavailable</span>';      
   }
   else {
      return '<span style="color:#0c0">Username Available</span>';
   }   
}
?>

Don't know much Ajax, sorry.
Eneru
I found this file uploader that has a progress meter during upload, you might want to give it a try:

http://php5.bluga.net/UploadProgressMeter/demo.php


download it here: http://bluga.net/projects/uploadProgressMeter/UploadProgressMeter.tar.gz

Hope that helps Smile
alalex
woodenbrick:
thanks but I had already checked on that.. I think that for some reason AJAX may not be enabled in my server, i'll have to contact the hosting company...

Eneru:
Thanks a lot!
thats just what I was looking for, now I'll just implement it and ready to go! Wink
manav
excuse me what do u mean by ajax not being enabled on ur servers...

dude please ajax is a part of javascript and they are both client side scripting languages...

problem is definitely something else.... dont make a fool of urself infront of ur webhosting providers by asking them a silly question like this....

best of luck...
alalex
manav:
Embarassed Really embarrassed for that... Sad
I'm sort of a newbie to AJAX, I'm more of a php programmer, and JavaScript, but I had never dealt with AJAX, so I thought It must have been some kind of client-server sort of thing.

Well, I'll keep on working on the problem, ill hope it gets solved,, Wink
sonam
[Deletet]

[EDIT]
Ohhhhhhhhh, Embarassed I didn't understand how is this script for new users not for olds.
[/EDIT]

Sonam
BlueVD
Here's what I get when I visit your page:
Code:

Warning: include(lib/xajax/isAvailable.php) [function.include]: failed to open stream: No such file or directory in /homepages/19/d223844992/htdocs/register.php on line 3

Warning: include() [function.include]: Failed opening 'lib/xajax/isAvailable.php' for inclusion (include_path='.:/usr/local/lib/php5') in /homepages/19/d223844992/htdocs/register.php on line 3

Fatal error: Call to a member function printJavascript() on a non-object in /homepages/19/d223844992/htdocs/register.php on line 16

Fix these and maybe we can take a look at it. from what I can tell, you have a problem in the DHTML part of your javascript.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.