0

Hello,

I know very little about programming, means what ever learn, i learnt it from the you tube, so in order to explain my problem i am writing every thing so when i get the reply i can understand it.

first i try to download apache, mysql and phpmyadminn but did not succed.

after that i downloaded XAMPP 1.7.7

In XAMPP 1.7.7 I gave this information for my security

**MYSQL SECTION: "ROOT" PASSWORD (This line was already there as a heading) **

MYSQL super user : root (it was already there so i cant change)
password : bluebus
PhpMyAdmin authentification: http or cokie (i select cokie),
Safe plain password in text file? ((File: C:\xampp\security\security\mysqlrootpasswd.txt): there was a check box i did not click,

XAMPP DIRECTORY PROTECTION (.htaccess) (this line was already there as a heading)

User: root
Password : redbus,
Safe plain password in text file? ((File: C:\xampp\security\security\mysqlrootpasswd.txt): there was a check box i did not click,

after that i went to phpmyadmin

user: root
Password : redbus,

after this i created a database, DATABASE NAME: CAR,

After this i added a new user for this database, NEW USER NAME: Member, and password i gave "redblue", and i created a table,

after this i created a new file in notpad++, the coding is

<?php

define ('DB_NAME', 'car');
define ('DB_USER', 'member');
define ('DB_PASSWORD', 'redblue');
define ('DB_HOST', 'localhost');

$link= mysql_connect (DB_HOST,DB_USER,DB_PASSWORD);

if (!$link) {
die ('could not connect:' . mysql_error () );
}

$db_selected=mysql_selected_db (DB_NAME, $link);

if (!$db_selected) {
die ('cant user' . ':' . mysql_error ());
}

$value = $_post ['input1'];

$sql= "INSERT INTO demo (input1) VALUES ('$value')";

if (!mysql_query ($sql)) {
die ('error:' . mysql_error () );
}

mysql_close ();
?>

when i try to run this its shows the error

Fatal error: Call to undefined function mysql_selected_db() in C:\xampp\htdocs\PhpProject1\index.php on line 14

please help thx

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by IIM
0

mysql_selected_db()

Actually "mysql_selected_db()" method doesn't exist.It must be "mysql_select_db()".
Replace it with mysql_selected_db().

For more details,Click here

0

thx man i did it and start working.. thx for your help and thx also for telling me the reason that why it was not working

thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.