Settings and mysql database creation

php

#1

I want someone to tell me how to add database details and create tables for following script

https://github.com/negm/ikimuk

if you go to class folder, it has class.database.php and settings.php. I have put database info in both files. Dont know right or wrong. My website is myb2b.freeweb.pk you can see error. I do not know how to create tables for this script. Need help.


#2

i picked one of the files from class, it contains for example this line:

$sSQL = "INSERT INTO artist (name, website,location,twitter,user_id) VALUES ('$this->name', '$this->website', '$this->location','$this->twitter',$this->user_id );";

which means in either php or mysql (or whatever database you have) you need to create all the tables, i can't see any php files which he seems to have used to create the tables, so could be he done that directly in sql, then it is really hard for you to reconstruct


#3

I have sql files from two different scripts which you can download from

1. B2B sql queries: http://myb2b.freeweb.pk/table.txt and /data.txt
&
2. Freelance site sql: http://myb2b.freeweb.pk/table1.txt

My questions

  1. The script I provided you earlier is an ecommerce. Is it possible to use any of these sql queries to create tables for that ecommerce script? How?

  2. If yes, I am not able to understand what changes do i have to make to use any of the queries for my script and to make it compatible with my site?


#4

Yes, it is. But you need a sql connect query in the beginning of the file (i don't see it, which makes sense, so you need to add it), then simple visit the php page which contains the sql query's, and you should be good (you can check in the sql console)


#5

Thank you. As you said earlier, there is no such php file. I haven't done such thing before, so have no idea at all.

  1. What if I goto phpmyadmin > SQL > paste these queries and run?
    A:

  2. In which files of the website script, I have to put the database details and most importantly where within that particular file. Can you mention the line numbers which I should edit to put my database details?
    A:

  3. Another confusion is, Do I need to make any changes to the query as it is for a different website?
    A:


#6

i am confused, let me get one thing straight. this: http://myb2b.freeweb.pk/table.txt and the other text file are query's to create the tables inside your database. Then you need another set of query's to retrieve data and store data in to the databases

If you haven't done such a thing before, isn't it a better idea to write your own query's to create the tables? and then your own query's to retrieve and store data in a database, and start with something small, rather then something so massive?


#7

ok :worried: for now, i only want to create tables.


#8

you can use phpmyadmin for that, and then sql, you can write your own query's, start with someting simple like:
create table tablename(
id INT NOT NULL,
name VARCHAR (20) NOT NULL,
age INT NOT NULL,
PRIMARY KEY (id)
);

source


#9

obviously replace table name with the name you want your table to have. You do know what int and varchar are right?


#10

ok thank you for your time


#11

you are right :wink:


#12

Then once you got this, make a second table, use a foreign key, learn about this, and joints etcetera, then expand it, by starting with making a design


#13

just tell me one last thing. In which file or files I should put my database details? and also tell me the line number in the files to edit. for example class.database.php and line number x to y.

By details I mean host, database name, database username and password


#14

write your own php files, don't use those, they are out of your leageau