|
Posted by Kevin Raleigh on 05/29/07 20:56
<snip>
I was able to get the connection made, and I read the documentation here:
http://dev.mysql.com/doc/refman/5.0/en/database-use.html
and was able to create the database;-)
But, I haven't been able to query the database.
I think the documentation is telling me to use one of the
following commands so that I can query my DB:
mysql> USE treemovers
This gives me database changed
But this one...???
mysql> GRANT ALL ON test.* TO 'raleigh'@'admin';
ERROR 1133 (42000): Can't find any matching row in the user table
mysql>
I'm not sure what this error is refering to, or how to proceed here.
In the tutorial I thought that this code:
<?php
$sql = "CREATE TABLE $table_name (";
for ($i=0; $i <count($field_name); $i++){
$sql .= "$field_name[$i] $field_type[$i]";
if ($field_length[$i] !=""){
$sql .= "($field_length[$i],";
}else{
$sql .= ",";
}
}
$sql = substr($sql, 0, -1);
$sql .= ")";
//create connection
//substitute your own hostname, username and password
$connection = mysql_connect($host_name,$user_name,$password) or die
("Couldn't connect to server.");
//select database
//substitute your own database name
$db = mysql_select_db($db_name, $connection) or die ("Couldn't select
database.");
//execute SQL query and get result
$sql_result = mysql_query($sql,$connection) or die ("Couldn't execute
query.");
if(!$sql_result) {
echo "<p>Couldn't create table!</p>";
}else{
echo "<p>$table_name has been created!</p>";
}
?>
should have created my table
with my fields and their attributes and stored the results?
But when I use the templates the tutorial had me create I have the
error:
("Couldn't execute query.");
can you advise?
Kevin
Navigation:
[Reply to this message]
|