Jump to content


Photo

PHP and Javascript combination problem


  • Please log in to reply
2 replies to this topic

#1 ViralStef

ViralStef
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 18 July 2006 - 02:35 PM

Hi

I have a script that generates a table. You have to type in the name of that table in an input field. If you click on the submit button, a script has to check if the table already exists. A Javascript warning should appear on the screen if the table already exists.
I made already the PHP script to test if the table exists:

function table_exists($table_name){
 $query = "SHOW TABLES LIKE '" . $table_name . "'";
 $result = mysql_query($query) or die(mysql_error($query));
 if(mysql_fetch_row($result)){
  return true;
 }
 else{
  return false;
 }
}

I only need to combine it with Javascript.

Is this possible?
Thx a lot!
Grtz

#2 willfitch

willfitch
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts
  • LocationNew Hope, PA

Posted 18 July 2006 - 02:51 PM

Yes it is, but you need to understand XMLHttpRequest, otherwise known as AJAX.  Go to http://www.ajaxfreaks.com and ask around there.
Zend Certified Engineer (ZEND001989)
www.willfitch.com

#3 ViralStef

ViralStef
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 18 July 2006 - 03:43 PM

Hm, ok. Thx:)!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users