Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Help me connect this to database
New Posts  All Forums:Forum Nav:

Help me connect this to database

post #1 of 14
Thread Starter 
I found this web-app on planet-source-code

I copied folder to my domain, created database and user for this db from cpanel.

Edited conit.php as it says in description.


$con=mysql_connect("localhost","test_name","test_password");
mysql_select_db("test-db");
?>

When I go to web address it asking to log in to system, but there is no users in database.
I found database folder with sql dump file and tried to import that file in ny database but getting error that i don't have permission to create database.
I contacted creator of software, but he is not replying for 2 days.

Hosting on hostmonster.
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
post #2 of 14
It seems that you don't have the permission to create a DB here. You need to contact hostmonster to create it for you.

Once created, we can work out the way how to connect to the DB.
XPS One 2710
(7 items)
 
  
CPUMotherboardGraphicsGraphics
i7 3770S 3.10Ghz Dell XPS One 2710 Nvidia Geforce GT 640M 2GB Intel HD Graphics 4000 
RAMHard DriveOS
16GB DDR3 SO-DIMM 1600Mhz 32GB mSATA SSD (SRT) + WDC Fireball 2GB Win8 64-bit 
  hide details  
Reply
XPS One 2710
(7 items)
 
  
CPUMotherboardGraphicsGraphics
i7 3770S 3.10Ghz Dell XPS One 2710 Nvidia Geforce GT 640M 2GB Intel HD Graphics 4000 
RAMHard DriveOS
16GB DDR3 SO-DIMM 1600Mhz 32GB mSATA SSD (SRT) + WDC Fireball 2GB Win8 64-bit 
  hide details  
Reply
post #3 of 14
Thread Starter 
I can create DB in cpanel.
I did. maybe Im not allowed to do it through script? can we delete part of creating db in dump file. Just name db somehow and I will create bd with same name manually.
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
post #4 of 14
Once you've created your db (along with the username and password), can you now connect to the DB with conit.php ?
XPS One 2710
(7 items)
 
  
CPUMotherboardGraphicsGraphics
i7 3770S 3.10Ghz Dell XPS One 2710 Nvidia Geforce GT 640M 2GB Intel HD Graphics 4000 
RAMHard DriveOS
16GB DDR3 SO-DIMM 1600Mhz 32GB mSATA SSD (SRT) + WDC Fireball 2GB Win8 64-bit 
  hide details  
Reply
XPS One 2710
(7 items)
 
  
CPUMotherboardGraphicsGraphics
i7 3770S 3.10Ghz Dell XPS One 2710 Nvidia Geforce GT 640M 2GB Intel HD Graphics 4000 
RAMHard DriveOS
16GB DDR3 SO-DIMM 1600Mhz 32GB mSATA SSD (SRT) + WDC Fireball 2GB Win8 64-bit 
  hide details  
Reply
post #5 of 14
Thread Starter 
I dont know how to check if it is connected. Newly created db is empty. In order to use app you need to login. Login info takes from db as i understand, but once again it is empty.
http://autodaddyin.net/eman/
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
post #6 of 14
Simply run the application and see if it throws out any error message. Have you created any new login to test?
XPS One 2710
(7 items)
 
  
CPUMotherboardGraphicsGraphics
i7 3770S 3.10Ghz Dell XPS One 2710 Nvidia Geforce GT 640M 2GB Intel HD Graphics 4000 
RAMHard DriveOS
16GB DDR3 SO-DIMM 1600Mhz 32GB mSATA SSD (SRT) + WDC Fireball 2GB Win8 64-bit 
  hide details  
Reply
XPS One 2710
(7 items)
 
  
CPUMotherboardGraphicsGraphics
i7 3770S 3.10Ghz Dell XPS One 2710 Nvidia Geforce GT 640M 2GB Intel HD Graphics 4000 
RAMHard DriveOS
16GB DDR3 SO-DIMM 1600Mhz 32GB mSATA SSD (SRT) + WDC Fireball 2GB Win8 64-bit 
  hide details  
Reply
post #7 of 14
Thread Starter 
It says USER DOES NOT EXIST.
Here is files I have.

1. conit.php with DB config (Click to show)

$con=mysql_connect("localhost","autodadd_test","test123");
mysql_select_db("autodadd_test");
?>

2. Log.php (Click to show)
include("conit.php");
$txtuser=$_GET;
$txtpass=$_GET;
$rs=mysql_query("select * from tbl_user where uname='$txtuser' and pword='$txtpass'");
$nm=mysql_num_rows($rs);
if($nm echo "0"."|"."Error: User does not exist";
exit;
}
else{
$rd=mysql_fetch_assoc($rs);
$name=$rd;
$rol=$rd;
setcookie("txtuser",$txtuser);
setcookie("roles",$rol);
setcookie("name",$name);
$nn=$_COOKIE;
echo "1"."|"."Welcome!";
}
?>
phpMyAdmin SQL Dump (Click to show)
-- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 20, 2012 at 08:20 AM
-- Server version: 5.1.36
-- PHP Version: 5.3.0

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `eman`
--
CREATE DATABASE `eman` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `eman`;

--

--
-- Table structure for table `leaks`
--

CREATE TABLE IF NOT EXISTS `leaks` (
`PNo` int(30) NOT NULL,
`Product` varchar(200) NOT NULL,
`DDate` varchar(12) NOT NULL,
`MDate` varchar(12) NOT NULL,
`Quantity` int(30) NOT NULL,
`Usern` varchar(100) NOT NULL,
`LeakID` int(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`LeakID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `leaks`
--

INSERT INTO `leaks` (`PNo`, `Product`, `DDate`, `MDate`, `Quantity`, `Usern`, `LeakID`) VALUES
(2, 'Bottle Water 5 ltrs', '06/02/2010', '06/02/2010', 1, '', 1);

--

--
-- Table structure for table `tbl_exp`
--

CREATE TABLE IF NOT EXISTS `tbl_exp` (
`refno` varchar(30) NOT NULL,
`Description` varchar(500) NOT NULL,
`DDate` varchar(12) NOT NULL,
`Reason` varchar(500) NOT NULL,
`Cost` int(30) NOT NULL,
`Remark` varchar(500) NOT NULL,
`ExpID` int(20) NOT NULL AUTO_INCREMENT,
`usern` varchar(20) NOT NULL,
PRIMARY KEY (`ExpID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `tbl_exp`
--

INSERT INTO `tbl_exp` (`refno`, `Description`, `DDate`, `Reason`, `Cost`, `Remark`, `ExpID`, `usern`) VALUES
('1', 'NEPA', '06/08/2010', 'For NEPA', 5000, 'Just a part payment for June', 1, '');

--

--
-- Table structure for table `tbl_pack`
--

CREATE TABLE IF NOT EXISTS `tbl_pack` (
`PackId` int(200) NOT NULL AUTO_INCREMENT,
`Pack` varchar(200) NOT NULL,
`PiecePack` int(200) NOT NULL,
`PricePiece` int(200) NOT NULL,
`PricePack` int(200) NOT NULL,
PRIMARY KEY (`PackId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `tbl_pack`
--

INSERT INTO `tbl_pack` (`PackId`, `Pack`, `PiecePack`, `PricePiece`, `PricePack`) VALUES
(1, 'Bottle Water 5 ltrs', 12, 100, 1200);

--

--
-- Table structure for table `tbl_rawmat`
--

CREATE TABLE IF NOT EXISTS `tbl_rawmat` (
`RawMatId` int(200) NOT NULL AUTO_INCREMENT,
`RefNo` varchar(200) NOT NULL,
`MType` varchar(200) NOT NULL,
`Quantity` int(200) NOT NULL,
`Meas` varchar(20) NOT NULL,
`Amount` int(200) NOT NULL,
`DDate` varchar(12) NOT NULL,
PRIMARY KEY (`RawMatId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `tbl_rawmat`
--

INSERT INTO `tbl_rawmat` (`RawMatId`, `RefNo`, `MType`, `Quantity`, `Meas`, `Amount`, `DDate`) VALUES
(1, 'hdhd', 'Polythene', 23, 'Pieces', 2400, '06/02/2010');

--

--
-- Table structure for table `tbl_sales`
--

CREATE TABLE IF NOT EXISTS `tbl_sales` (
`SalesID` int(30) NOT NULL AUTO_INCREMENT,
`refno` varchar(200) NOT NULL,
`Product` varchar(200) NOT NULL,
`Price` int(30) NOT NULL,
`DDate` varchar(12) NOT NULL,
`Amount` int(30) NOT NULL,
`Quantity` int(30) NOT NULL,
`usern` varchar(100) NOT NULL,
`Meas` varchar(12) NOT NULL,
PRIMARY KEY (`SalesID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `tbl_sales`
--

INSERT INTO `tbl_sales` (`SalesID`, `refno`, `Product`, `Price`, `DDate`, `Amount`, `Quantity`, `usern`, `Meas`) VALUES
(1, '1', 'Bottle Water 5 ltrs', 100, '06/09/2010', 100, 1, '', 'Pieces'),
(3, '2', 'Bottle Water 5 ltrs', 100, '02/20/2012', 1200, 12, '', 'Pieces');

--

--
-- Table structure for table `tbl_stock`
--

CREATE TABLE IF NOT EXISTS `tbl_stock` (
`StockID` int(200) NOT NULL AUTO_INCREMENT,
`Product` varchar(200) NOT NULL,
`DDate` varchar(12) NOT NULL,
`Quantity` int(200) NOT NULL,
`PNo` int(200) NOT NULL,
`Meas` varchar(20) NOT NULL,
PRIMARY KEY (`StockID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `tbl_stock`
--

INSERT INTO `tbl_stock` (`StockID`, `Product`, `DDate`, `Quantity`, `PNo`, `Meas`) VALUES
(3, 'Bottle Water 5 ltrs', '06/09/2010', 24, 3, 'Pieces'),
(1, 'Bottle Water 5 ltrs', '06/05/2010', 12, 1, 'Packs'),
(2, 'Bottle Water 5 ltrs', '06/02/2010', 2, 2, 'Packs');

--

--
-- Table structure for table `tbl_user`
--

CREATE TABLE IF NOT EXISTS `tbl_user` (
`userID` int(30) NOT NULL AUTO_INCREMENT,
`uname` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL,
`pword` varchar(200) NOT NULL,
`Telephone` varchar(20) NOT NULL,
`roles` varchar(20) NOT NULL,
PRIMARY KEY (`userID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `tbl_user`
--

INSERT INTO `tbl_user` (`userID`, `uname`, `name`, `pword`, `Telephone`, `roles`) VALUES
(1, 'segun', 'Akinyemi Olusegun', 'samson', '08066405654', 'Admin'),
(2, 'dada', 'Dada Edusetan', 'admin', '09087644556', 'User');

As I understand I need to go yo mysql admin and import this dump file, which will create eman database with all needed information. than I have to use information in database to login.
Edited by ASSSETS - 10/26/12 at 11:33am
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
post #8 of 14
Thread Starter 
In db.txt dump file I removed create database line
now I have this error. I need to tell in what database import.

Update. I went in to my database from cpanel and click import. now it worked.
Will check with login info.
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
post #9 of 14
Thread Starter 
In user table i see login and password. Now I can login from main page.
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
MACHINE
(15 items)
 
  
CPUMotherboardGraphicsRAM
amd x6 1090t Asus CROSSHAIR IV HD 5870 2GB E6 G.SKILL Ripjaws X Series 8GB 2133 
Hard DriveHard DriveCoolingOS
RealSSD 64Gb Seagate Barracuda 7200.12 500 corsair h70 Windows 7 Pro 
MonitorKeyboardPowerCase
Asus VW266H 1920x1200 Logitech G-15 CORSAIR HX750 Antec 900 
Mouse
Logitech Performance MX 
  hide details  
Reply
post #10 of 14
Quote:
Originally Posted by ASSSETS View Post

In user table i see login and password. Now I can login from main page.

So that means your DB is now connected to the application. Any more issues with the DB?
XPS One 2710
(7 items)
 
  
CPUMotherboardGraphicsGraphics
i7 3770S 3.10Ghz Dell XPS One 2710 Nvidia Geforce GT 640M 2GB Intel HD Graphics 4000 
RAMHard DriveOS
16GB DDR3 SO-DIMM 1600Mhz 32GB mSATA SSD (SRT) + WDC Fireball 2GB Win8 64-bit 
  hide details  
Reply
XPS One 2710
(7 items)
 
  
CPUMotherboardGraphicsGraphics
i7 3770S 3.10Ghz Dell XPS One 2710 Nvidia Geforce GT 640M 2GB Intel HD Graphics 4000 
RAMHard DriveOS
16GB DDR3 SO-DIMM 1600Mhz 32GB mSATA SSD (SRT) + WDC Fireball 2GB Win8 64-bit 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Help me connect this to database