can someone please tell me whats wrong with this!

this is my code..... bare with me i'm a beginner....

<?


// open link to the mysql dbase

$bd = mysql_connect("localhost","httpd","");

$mysql_select_db("busdir",$bd);

// put array info into a row in the busdir table

$query = "INSERT INTO busdir VALUES ($dest, $company, $email, $phone, $address, $city, $state, $zip)";

mysql_query($query,$bd);

?>

this is the error i get
Fatal error: Call to undefined function: () in addbus.php on line 8

I am using a mysql database.  The db name is busdir and the table name is also busdir.  I am using ximati web server in win98, is there any way to load mysql w/server instead of just using the mysqld --bind " " ?
can anyone help?
RainAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oubelkasCommented:
Rain,

With the function mysql_select_db() you call a certain database on your server. What you do here, is, if correctly said, calling a table named busdir. So this is not possible and therefore the error is given.

If I understand correctly you want to put some values in the busdir table, well do as follows then :

first connect to the database

mysql_connect("localhost","httpd","");

then the query

$query = "INSERT INTO busdir VALUES ($dest, $company, $email, $phone, $address, $city, $state, $zip)";

execute query

 $result = mysql_db_query($database,$query);

So the database isn't busdir but has it's own name.

Joseph
0
oubelkasCommented:
PS : of course check http://www.php.net for the working of all functions and the existing of them.

Joseph
0
Gerhard100198Commented:
Rain,


<?

    // open link to the mysql dbase

   //GVR This is correct
   $bd = mysql_connect("localhost","httpd","");

  //GVR This is correct IF yuor database is called busdir
   $mysql_select_db("busdir",$bd);

    // put array info into a row in the busdir table

   //GVR This is correct.... I notice that you are inserting the info into busdir. If you database is called BUSDIR then maybe you are specifying the wrong table name below. If busdir IS your table name then you are trying to connect to your table instead of your database with the $mysql_select_db.
    $query = "INSERT INTO busdir VALUES ($dest, $company,
                $email, $phone, $address, $city, $state, $zip)";

    $result = mysql_query($query,$bd);

?>

If this solves your problem let me know then I'll post this as an answer.

Gerhard
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

oubelkasCommented:
Gerhard,

the questioner can also accept one's comment as an answer. Just in case you didn't know ;)

Oh, and my comment here isn't much that different, is it? I think Rain is trying to put values in a database instead of table.

Joseph
0
RainAuthor Commented:
Edited text of question.
0
Gerhard100198Commented:
OK, so there goes my theory. :/

What line exactly does it bomb out on? Not the line number but the text?

OK, let's start with the simple stuff.

1) Have you uncommented the mysql.dll entry in the PHP-ini file?

2) What happens when you try and run a normal select in the query instead of an insert? ($query = "select * from busdir)
0
gravityCommented:
Rain, I remember commenting a question whereby the problem was caused because the questioner was running php4 beta 3 which has problems with the mysql_select_db() function where a connection operatory was given, in this case the $bd.
0
esnagelCommented:
The error is here:

$mysql_select_db("busdir",$bd);

The error message:
Fatal error: Call to undefined function: () in addbus.php on line 8

Indicates the function is not there.  Notice the function name '()' - meaning the function has no name.

You are using an undeclared variable for the function name.

mysql_select_db("busdir",$bd);

will work just fine.  Or even:

$a = "mysql_select_db";
$a("busdir",$bd);

Should work - but it's kind of hard to read.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.