Page 1 of 1

QUERY execution problem in MySQL

Posted: Tue Nov 19, 2002 10:05 pm
by Genteel Beaux
I am new to PHP and MySQL. I am more of a ASP and Access/MS SQL Server type person so connecting to databases and stuff is nothing new to me. But what is wrong with this code?
1. <?
2. // This is the MySQL Server database connection
3.
4. $linkID = mysql_connect("localhost","","") or die("Connection error");
5.
6. mysql_select_db("MyFirstDatabase", $linkID);
7.
8. $query = "SELECT * FROM MyFirstTable"
9
10. $result = my_sql_query($query) or die(mysql_error());
11.
12. mysql_close($linkID);
13. ?>
I have no problems connecting to the database. But no matter what type of query I use, I keep getting this same error.
Fatal error: Call to undefined function: my_sql_query() in c:\program files\apache group\apache\htdocs\test.php on line 10
It doesn't even make it to line 12.

What am I doing wrong? Are there any permission issues in MySQL that I need to be aware of?

mysql

Posted: Wed Nov 20, 2002 12:45 am
by mester
Try mysql_query...

Posted: Wed Nov 20, 2002 2:18 am
by twigletmac
Handy reference of all of the available MySQL functions in PHP:
http://www.php.net/manual/en/ref.mysql.php

If you get 'undefined function' errors it's always a good idea to check the spelling of the function that you're using in case unintentional characters have crept in to cause havoc.

Mac

Posted: Wed Nov 20, 2002 3:42 pm
by Genteel Beaux
Thanks guys.