Hi, I decided to create a Apache server which parses php code brilliantly. I then decided to install mysql so I could use database driven web pages.
With mysql from the cmd prompt I can create change and delete databases. I can execute query's and add tables. The problem is within the php script !
As you can tell mysql ovbivous runs ok but when it comes to creating a table within a php script it just doesn't work. I can connect where I used the code below to test mysql.(shows mysql info)
<?php
mysql_connect("localhost","user","passwd") or die("Uh Oh, Could not connect");
$Version = mysql_get_server_info();
$HostInfo = mysql_get_host_info();
print "My current MySQL version is: $Version<br>On $HostInfo";
?>
But... when i try to execute a query or try and create a database, table it doesn't work.
code below shows a query which i wanted to use as a TEST.
<?php
$username = "user";
$password = "passwd";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password);
if (!$dbh){
print mysql_error();
}
$selected = mysql_select_db("first_new",$dbh);
if (mysql_query("insert into people values('5','tom','Burger')")) {
print "successfully inserted record";
}
else {
print "Failed to insert record";
}
mysql_close($dbh);
?>
Here i can connect but not insert record. I have set all permissions for the mysql user so it shouldn't be a problem. Could someone please help, thank you...