Issues with PHP/MySQL operations
Posted: Tue Mar 28, 2006 11:35 am
I'm not exactly sure, if I need a MySQL connector.
I am new to this. But from what I can understand from
documentation, it seems as if it is not necessary to install
a MySQL Ruby Connector, etc.
PHP Installation Path: C:\PHP
Apache2 Installation Path: C:\Apache2\
MySQL Installation Path: C:\MySQL\
I am running WindowsXP Pro.
Apache Version: 2.0.55
PHP Version: 5.1.2
MySQL: 5.0.19
PHPInfo provides me information, which makes me believe
that my installation of PHP is fine, aswell as activation of
PHP/MySQL extensions.
My issue is that, when I run this operation. Nothing happens,
it doesn't complete the operation and doesn't provide any errors
as are mysql_error(); is listed, aswell as commands to say, "Connection
Successful", etc.
I check my MySQL Command-line to see if anything has been
added to the database.table but nothing happens.
MySQL Administrator can access the MySQL server,
MySQL QueryBrowser can access the MySQL server.
It is operating off of, port 3307.
I am running the following code and I'd appreciate any commentation:
Much Appreciation,
Max
I am new to this. But from what I can understand from
documentation, it seems as if it is not necessary to install
a MySQL Ruby Connector, etc.
PHP Installation Path: C:\PHP
Apache2 Installation Path: C:\Apache2\
MySQL Installation Path: C:\MySQL\
I am running WindowsXP Pro.
Apache Version: 2.0.55
PHP Version: 5.1.2
MySQL: 5.0.19
PHPInfo provides me information, which makes me believe
that my installation of PHP is fine, aswell as activation of
PHP/MySQL extensions.
My issue is that, when I run this operation. Nothing happens,
it doesn't complete the operation and doesn't provide any errors
as are mysql_error(); is listed, aswell as commands to say, "Connection
Successful", etc.
I check my MySQL Command-line to see if anything has been
added to the database.table but nothing happens.
MySQL Administrator can access the MySQL server,
MySQL QueryBrowser can access the MySQL server.
It is operating off of, port 3307.
I am running the following code and I'd appreciate any commentation:
Code: Select all
<?php
if(isset($submit)):
$username = "max";
$password = "**********";
$hostname = "127.0.0.1:3307";
$table = 'losangeles';
$name = $_GET['name'];
$address = $_GET['address'];
$city = $_GET['city'];
$zip = $_GET['zip'];
$state = $_GET['zip'];
$db = mysql_connect($hostname, $username, $password);
if (!$db) {
die ('Not connected : ' . mysql_error());
}
echo 'Connected successfully';
$db_selected = mysql_select_db('usmail', $db);
if (!$db_selected) {
die ('Can\'t use usmail : ' . mysql_error());
}
$sql = "INSERT INTO $table
VALUES(NULL,'$name','$address','$city','$zip','$state')";
mysql_query($sql);
mysql_close($db_selected);
endif;
?>
<h3>Los Angeles County</h3>
<form action="data_in.php" method="post">
Name:<br />
<input type="text" name="name" />
<br /><br />
Address:<br />
<input type="text" name="address" />
<br /><br />
City:<br />
<input type="text" name="city" />
<br /><br />
Zip Code:<br />
<input type="text" name="zip" />
<br /><br />
State:<br />
<input type="text" name="state" />
<br /><br />
<br />
<input type="submit" name="submit" value="Submit!" />
</form>Max