Koozali.org: home of the SME Server

Determining how to use localhost with php &mysql

Offline jock

  • **
  • 33
  • +0/-0
Determining how to use localhost with php &mysql
« 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.

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: Determining how to use localhost with php &mysql
« Reply #1 on: October 23, 2008, 05:13:35 AM »
ock

I think you use
127.0.0.1
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline chris burnat

  • *****
  • 1,135
  • +2/-0
    • http://www.burnat.com
Re: Determining how to use localhost with php &mysql
« Reply #2 on: October 23, 2008, 07:21:22 AM »
Moving topic to general discussion, where it is more appropriate.
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.

Offline jock

  • **
  • 33
  • +0/-0
Re: Determining how to use localhost with php &mysql
« Reply #3 on: October 23, 2008, 03:32:23 PM »
Thanks, Mary. It turned out to be a missing " mark in the php script.
 :shock: