Jump to content

[SOLVED] Beginner Help.


tj71587

Recommended Posts

Hey all I just installed php and mysql on a cent os box.  I am able to get phpinfo() to display, therefore I am sure it installed.  I am just trying to insert things into the data base using this code:  (I have a database named test and a table named tracker with the fields username and password)

<html>
<head>
<title>DBASE</title>
</head>
<body>
<?php
include 'includes/config.php';
include 'includes/opendb.php';

mysql_select_db($mysql);
$query = "INSERT INTO test ( tracker.username, tracker.password) VALUES ('TEST', 'TEST')";

mysql_query($query) or die('Error, insert query failed First One');

$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');

include 'includes/closedb.php';
?>
</body>
</html>

 

Here are the includes I have:

 

config.php:

<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$dbname = 'test';
?>

opendb.php:

<?php
// This is an example opendb.php
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
mysql_select_db($dbname);
?>

closedb.php:

<?php
// an example of closedb.php
// it does nothing but closing
// a mysql database connection

mysql_close($conn);
?>

I get this error message: Error, insert query failed First One

 

Is it a php setting or mysql setting or is my syntax just wrong.

 

thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.