Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: jock on October 23, 2008, 04:15:38 AM

Title: Determining how to use localhost with php &mysql
Post by: jock on October 23, 2008, 04:15:38 AM
 :? I am attempting to follow a tutorial for php & mysql using a form to insert data into a table and can't figure out what to use in place of localhost as it doesn't seem to work. I have used "homeserver.domainname", homeserver@domainname", "domainname" and can't seem to make this work.

This is the php script I am using:

 
  $first=$_POST['first'];
  $last=$_POST['last'];
  $phone=$_POST['phone'];
  $mobile=$_POST['mobile'];
  $fax=$_POST['fax'];
  $email=$_POST['email'];
  $web=$_POST['web'];
 
  mysql_connect(homeserver.johnjchisholm.ca,$username,$password);
  @mysql_select_db($database)   or die( ;Unable to select database;);
 
  $query = ;INSERT INTO contact VALUES   ('','$first','$last','$phone','$mobile','$fax','$email','$web');;
  mysql_query($query);

?>

Any suggestions as to where I am going wrong. The db is named contacts and the table name is contact. Thanks for any help you can offer this newbie.
Title: Re: Determining how to use localhost with php &mysql
Post by: janet on October 23, 2008, 05:13:35 AM
ock

I think you use
127.0.0.1
Title: Re: Determining how to use localhost with php &mysql
Post by: chris burnat on October 23, 2008, 07:21:22 AM
Moving topic to general discussion, where it is more appropriate.
Title: Re: Determining how to use localhost with php &mysql
Post by: jock on October 23, 2008, 03:32:23 PM
Thanks, Mary. It turned out to be a missing " mark in the php script.
 :shock: