Re: Re: help with mysql

From: Date: Tue, 27 Jan 2004 13:49:08 +0000
Subject: Re: Re: help with mysql
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-175905@lists.php.net to get a copy of this message
line 16: mysql_connect("tflood", "thomas91"); I think you mean: mysql_connect("localhost", "tflood", "thomas91"); otherwise mysql_connect takes "tflood" as Server and "thomas91" as Username (if so, its better to replace passwords with ***** before posting) -> http://ch.php.net/mysql_connect after connecting you need to choose a database, e.g. line 17: mysql_select_db("databasename"); also make sure that the mysql-extension is installed and loaded. to check this, create a textfile "phpinfo.php" with this content: <? phpinfo(); ?> check the output for information about mysql g. tinu Tue, 27 Jan 2004 08:51:52 -0500 Tom Flood <tflood91@msn.com>:
Thank you both, here is the entire code : 1<html> 2<head> 3<title>Untitled Document</title> 4<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 5</head> 6 7<body> 8<?php 9 $name = $_GET["name"]; 10 $address = $_GET["address"]; 11$city = $_GET["city"]; 12print "Name is $name<br>\n"; 13print "Address is $address<br>\n"; 14print "City is $city<br>\n"; 15 16mysql_connect("tflood", "thomas91"); 17 18$result = mysql_query( 19 "insert into ephi.info 20 (name, address, city) values 21 ('$name', '$address', '$city')" 22); 23if ($result) { 24 print <<<EOT 25 26 <h1> Thank you. </h1> 27 Your signup is highly appreciated. To show our appreciation, we will send you something that you, in turn, will appreciate. <p> 28 Remember our motto: Once a Sinfonian, Always a Sinfonian, Long Live Sinfonia! 29EOT; 30 } 31 else { 32 print "Something went wrong dunbass"; 33 } 34 mysql_close(); 35?> 36</body></html> As far as mysql working on the machine, it is. I am able to use the mysql command to loginto the server and query my databases. And I have the MySQL Command Center installed and am able to see the databases on my computer just fine. Thank you for your help. Tom "Krit Kanrat" <guy@microthai.com> wrote in message news:20040127084245.89510.qmail@pb1.pair.com...
Hi, Are you sure that you already enable mysql function on your web server ? Krit Kanrat "Tom Flood" <tflood91@msn.com> wrote in message news:20040127061014.99658.qmail@pb1.pair.com...
Hello, I am just beginning my learning of php and its uses with mysql. I wrote a small program to add information into a mysql database. However my script returns the following error: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/ephi/mysql.php on line 16 what is the problem here? How can I fix it? I truly appreciate any help given. Tom Flood tflood91@msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#175905) next »