QUERY execution problem in MySQL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Genteel Beaux
Forum Commoner
Posts: 28
Joined: Wed Nov 13, 2002 4:07 pm
Location: Alabama

QUERY execution problem in MySQL

Post 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?
mester
Forum Newbie
Posts: 5
Joined: Fri Aug 02, 2002 3:40 am

mysql

Post by mester »

Try mysql_query...
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Genteel Beaux
Forum Commoner
Posts: 28
Joined: Wed Nov 13, 2002 4:07 pm
Location: Alabama

Post by Genteel Beaux »

Thanks guys.
Post Reply