Hi I have just got PHP and MySQL going on my machine and am doing my first tutorial. Just started and already am stuck.
1) Have been trying to access a small table i created and keep getting this error.
PHP Warning: mysql_query() [function.mysql-query]: Unable to save result set in C:\Inetpub\wwwroot\test.php on line 21 PHP Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\test.php on line 25 PHP Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\test.php on line 29
It´s probably due to an error in the records entered but I have just realised that WINMYSQLAdmin does not have the facility to create, destroy, delete or VIEW tables, or records.
?What application do I need to edit/records my tables manually?
2) I read in a posting that it is possible to import and export a database from WinMySQLAdmin but cannot seem to find the option, should this only be done from the dos promt/shell.
Any help would be great
williery (Novice)
Viewing records/Deleting Tables
Moderator: General Moderators
-
williery10
- Forum Newbie
- Posts: 15
- Joined: Thu Feb 20, 2003 4:23 am
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
williery10
- Forum Newbie
- Posts: 15
- Joined: Thu Feb 20, 2003 4:23 am
no problem
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>\n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));
printf("Address: %s<br>\n", mysql_result($result,0,"address"));
printf("Position: %s<br>\n", mysql_result($result,0,"position"));
?>
</body>
</html>
I copied this directly from the tutorial
I linked the mysql to an access db to view my records and they look fine so am at a bit of a loss
cheers williery
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>\n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));
printf("Address: %s<br>\n", mysql_result($result,0,"address"));
printf("Position: %s<br>\n", mysql_result($result,0,"position"));
?>
</body>
</html>
I copied this directly from the tutorial
I linked the mysql to an access db to view my records and they look fine so am at a bit of a loss
cheers williery
Well, from what I can see, you might not be connecting to the database correctly.
Is there a username "root" without a password in your MySQL? Or is your domain localhost?
(I had this error on my linux machine a while back and realized "localhost" was not correct and I had to use "localhost.localdomain".)
But it sounds like you are on a windows box.
Is there a username "root" without a password in your MySQL? Or is your domain localhost?
(I had this error on my linux machine a while back and realized "localhost" was not correct and I had to use "localhost.localdomain".)
But it sounds like you are on a windows box.
Hmm, as I looked through your post again I noticed the errors were for lines like 25 and 29 while your whole page (that you posted) is only like 15 lines. Hmmm.
And if you want to edit your MySQL manually (tables, databases, records) you can use phpMyAdmin. http://www.phpmyadmin.net[/url]
And if you want to edit your MySQL manually (tables, databases, records) you can use phpMyAdmin. http://www.phpmyadmin.net[/url]
-
williery10
- Forum Newbie
- Posts: 15
- Joined: Thu Feb 20, 2003 4:23 am