if you know mysql and php, please help!
this is suppost to connet to my database, and insert data into the table. but as far as it goes is connecting. after that it dies, it will not query the table add data or anything. It just dies! WHY!? It dies right there on the $db = @mysql_select($db_name, $connection) or die ("cannot select");
Code:
// database functions
$db_name = "photos";
$table_name = "data";
$connection = @mysql_connect("localhost", "xxxxx", "xxxxx") or die ("cannot connect");
$db = @mysql_select($db_name, $connection) or die ("cannot select");
$sql = "
INSERT INTO $table_name(set_id, locate, name)
VALUES
(\"$abox\", \"$bbox\", \"$cbox\")
";
$result = @mysql_query($sql, $connection) or die ("cannot connect");
?>
all this thing produces is cannot select.
Does it matter that I have yet to set a user name and password for this stuff? I just use localhost nothing else. the x's here represent where t he user name and password should be.
Re: if you know mysql and php, please help!
PHP Code:
// database functions
$db_name = "photos";
$table_name = "data";
$connection = @mysql_connect("", "", "") or die ("cannot connect");
$db = @mysql_select($db_name, $connection) or die ("cannot select");
$sql = "
INSERT INTO $table_name(set_id, locate, name)
VALUES
(\"$abox\", \"$bbox\", \"$cbox\")
";
$result = @mysql_query($sql, $connection) or die ("cannot connect");
?>
Should work now :)
Are you running this locally?
Re: Re: if you know mysql and php, please help!
Quote:
Originally posted by da_silvy
PHP Code:
// database functions
$db_name = "photos";
$table_name = "data";
$connection = @mysql_connect("", "", "") or die ("cannot connect");
$db = @mysql_select($db_name, $connection) or die ("cannot select");
$sql = "
INSERT INTO $table_name(set_id, locate, name)
VALUES
(\"$abox\", \"$bbox\", \"$cbox\")
";
$result = @mysql_query($sql, $connection) or die ("cannot connect");
?>
Should work now :)
Are you running this locally?
got a fatal error on line 7 call to undefined function mysql_select()