Pikachu2000
-
Posts
11,377 -
Joined
-
Last visited
-
Days Won
11
Posts posted by Pikachu2000
-
-
The query is failing and returning a boolean FALSE. This usually indicates a syntax error in the query, if the connection is known to be good. If you have phpMyAdmin, paste the query into the SQL tab and see what the result is, or try it from a mysql> command line.
-
You can't use solely PHP to perform any form validation without submitting the form. PHP, as you know, is a server side language. Make the form fields sticky, and validate it all at once, using header() to redirect to a success page if submitted with no errors, or redisplay the form with the errors highlighted (if there are errors) or if the username is unavailable.
-
Anyone?
Replace the $mydb variable in the query by explicitly stating the database name and see if it gives you anything.
What is the error you are getting now?
-
It is a mysql connect object.
If it's just the database name, it should work in the query, if it is a
$mydb = mysql_connect( $db_host, $db_user, $db_pass );
statement, it will not. That means you will have to use a variable containing only the database name. Try echoing the $sql variable to see what you are sending as a db query.
-
Thanks
Everytime I try it I get a mydb could not be converted to string.
$sql = "SHOW TABLES FROM $mydb" or die (mysql_error()); $result = mysql_query($sql); while ($row = mysql_fetch_row($result)) { echo "Table: {$row[1]}\n"; }
Assuming you have the $mydb variable's value set elsewhere, this should work for you.
$query = "SHOW TABLES FROM " . $mydb; $result = mysql_query( $query ); while( $array = mysql_fetch_array( $result, MYSQL_ASSOC) ) { print_r( $array ); }
Stumped while trying to read MySql database.
in PHP Coding Help
Posted
You should be prompted for username/password when you access phpMyAdmin via the URL. I don't know what path it is installed to under WinD'ohs, but if you go to http://localhost do you get the WAMP information page and a link (somewhere on the page) to phpMyAdmin? What happens if you use that link?