Nov 8, 2009

Connecting Php Site To Database

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > PHP Programming

Connecting Php Site To Database

veightar
Please Help Me with this site's error
http://gatewaybiz.x10hosting.com/surf/

Comment/Reply (w/o sign-up)

jlhaslip
No-one here can help you, except to suggest that you check, and confirm with the Hosting company, that you are using the correct user-name and password, and that you are attempting to open the correctly named database.
That is what the error suggests.
Answer these questions so we an be of more service to you:

What script are you installing?
Are you allowed databases on that service?
Do they add a prefix to our DB name when you create the DB?
Did you include the prefix?

Comment/Reply (w/o sign-up)

reconraiders
yeah, basically just check all your database info like user, password, db name, host, etc

Comment/Reply (w/o sign-up)

veightar
Thank you Guys. Actually my hosting user name is makj and have a db and indeed adds a prefix to my db user name.
I created a db with a named blog and a user name surf. My hosting added the the prefix making the db makj_blog and the username makj_surf. I don't really know whether to include the prefix makj when setting up the script. In the page I showed, I added the prefix makj to it. Should I add the prefix makj to the username or db?
I am indeed installing a surfing script

http://gatewaybiz.x10hosting.com/surf/

Once again thank you.

Comment/Reply (w/o sign-up)

jlhaslip
Add the prefix to both the db-name and the db-user-name.

Comment/Reply (w/o sign-up)

veightar
I very much appreciate this help. thank you and I'll try that but before then, Please take a look at the file that is mentioned in the page ie. require.inc.php and help me with the changes I need to make in
CODE
<?
global $username;
require 'dconn.php';
session_start();

$username = @$_SESSION["username"];

$connection = mysql_connect($db_server, $db_user,$db_pass) or die(mysql_error());
mysql_select_db($db_name, $connection) or die(mysql_error());

// A few important variables to set
$title = "Gateway SuperSurf";
$motto = "Free hits without the bandwidth";
$siteUrl = "http://gateway.x10hosting.com/surf/"; // remember to include the end slash
$contact_email = "support@gateway.x10hosting.com";
$paypal= "mickeyaff@yahoo.com";
$emailFooter = " - You are receiving this email because you are currently a member of ".$title.".";

 

 

 


Comment/Reply (w/o sign-up)

.hack//GU
QUOTE(veightar @ Sep 23 2007, 05:28 PM) *
I very much appreciate this help. thank you and I'll try that but before then, Please take a look at the file that is mentioned in the page ie. require.inc.php and help me with the changes I need to make in
CODE
<?
global $username;
require 'dconn.php';
session_start();

$username = @$_SESSION["username"];

$connection = mysql_connect($db_server, $db_user,$db_pass) or die(mysql_error());
mysql_select_db($db_name, $connection) or die(mysql_error());

// A few important variables to set
$title = "Gateway SuperSurf";
$motto = "Free hits without the bandwidth";
$siteUrl = "http://gateway.x10hosting.com/surf/"; // remember to include the end slash
$contact_email = "support@gateway.x10hosting.com";
$paypal= "mickeyaff@yahoo.com";
$emailFooter = " - You are receiving this email because you are currently a member of ".$title.".";


how about db_server variable? From what I know, this variable is the one many people have mistaken. You have to confirm with your database server contact, so you can connect them.

Or even your user I guess...

Comment/Reply (w/o sign-up)

(G)Mark
UNABLE TO DISPLAY DATA ON LOGGING INTO MYSQL DATABASE.
Connecting Php Site To Database

Hello dear Friends,

I am new to php scripts with a below average understanding. I`d be glad to be assisted in the following way:

1). Pls I need a php code that can log into the below stated database and display single rows from the table using the username and password given each time only for authentication.

2). And also after login in, how can I prevent someone from using the logged in sites page url to view the page without signing in with their username and password.

3). I can design forms and validate with dreamweaver, but I am not able to display the results from the database. I`ve been trying this for over a month now and just need help greatly. E.G, after login into the database using the username "dandy" and password "53423", I want to get the following single row (and column headers) displayed too:

============================================================
|_Username _|_ Password_ |_ _Age_ _ | _ _State_ _ |_ _Inv. No._ _ | _ _Day Ord._ _ |
============================================================
|_ _dandy_ _ |_ _53423_ _ |_ _67_  _ | _ _NC_   _ |_ _000013_ _ |  _ _ _Wed_  _ _ |

The rows will be displayed in a php page. I have attempted to use dreamweaver to solve the problem, but the php scripts written by dreamweaver were not successful in the task.

4). Also, how do I prevent someone that has logged in from using using the back button to navigate out of his account and back again?; which might not be secured in case he leaves his session logged on mistakenly.

5. WHAT I NEED IN ESSENCE, IS HOW "DIIFERENT CLIENTS" CAN SECURELY LOG INTO A DATABASE FROM THEIR WEB BROWSER AND VIEW THE DISPLAYED AND REQUIRED ROW(NOT COLUMN ONLY) RESULTS ON THEIR WEB PAGE!

The following details are given for the php codes:

Server: localhost
Username: markud
Password: globalday
Database: orderlist
Table: invoice

   == I and V O I C E ==
    =======================================================
    |_Username _|_ Password_ |_Age_ | _ _State_ |_ _Inv. No.  _ | _ _Day Ord._ _ |
    =======================================================
A. |_ _jenny_  _ |_ _23453_ _ |_46  _ |  _ _GA _ |_ _000001_ _ |  _ _ _Wed_ _ _ |
 
B. |_ _gregg_  _ |_ _07867_ _ |_55 _ | _ _OH   _ |_ _000043_ _ | _ _ _Tue_ _ _ _|

C. |_ _dipoe_  _ |_ _89787_ _ |_28 _ | _ _NY   _ |_ _000401_ _ |_ _ _Thu_ _ _ _ |

D. |_ _tsoni_   _ |_ _62239_ _ |_32 _ | _ _CA   _ |_ _000765 _ _ |_ _ _Mon  _ _ _|
 
E. |_ _dandy_ _ |_ _53423_ _ |_67 _ | _ _NC   _ |_ _000013_ _ |  _ _ _Wed  _ _ |

F. |_ _veron_ _ |_ _37342_ _ |_34 _ | _ _TX    _ |_ _000038 _ _ |  _ _ _Sat_ _  _ |

G. |_ _lucas_  _ |_ _67552_ _ |_43 _ | _ _MO  _ |_ _000009 _ _ |  _ _ _Fri_ _ _ _|

(You can disregard the row alphabet labeling I.E A., B., C., D. Etc).

I will be grateful if this can work properly as soon as possible. And any other advice - general or particular; I can get in php scripting or software that could write good php codes.

I will give credit and acknowledgements for helping me out.

Thank and I appreciate a positive response in advance.

Mark.


Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Connecting Php Site Database

  1. Can You Add Images Into A Mysql Database? - Using Php? (23)
    I'm learning php in class right now, but I'm still not that good at it, what I'm
    wondering is when I write the php so that it can connect with a database, can I at the same time
    have it that it is able to display back images that I choose. Like, I want a search feature, where
    you can search for a keyword, and it will bring back a list of all the possible entries with that
    keyword, but each of these entries will have a photo associated with it. Now, do I put these image
    files directly into the database, or do I write the code to link them from my files to th...
  2. Auto Pruning An Sql Database With Php - How can i do this? (5)
    Hey all. Now i have a DB, an SQL DB, and i need to auto prune the data there to delete rows lder
    than a certain time, lets say 2 months for now, the question is how do i do this? The obvious thing
    is just to add a field which is the numerical representation of the month when the data is entered
    and every time the DB is accessed it will check this number against the current month,in a numerical
    format, and if the difference is two or greater that row is deleted, so if the month is January, it
    would be O1 and if the current month is march then it would be O3 and the diff...
  3. Ms-access Database Question - Allowing Web Access to the Informaton (3)
  4. How Do I Connect To Live Database With Php Script? - while being hosted with ComputingHost (6)
    I am not new to programming. I want to create a form to add some values into my tables, the code
    are all working. But I am not sure what is the URL to connect to my site's database. All along,
    I have been testing through MAMP, which provides a local copy of mySQL. Can anyone lend me a hand?...
  5. Xbox Gamertag Profile On Site - (2)
    Alright, first off, sorry about the title, can't exactly explain it well. Basically, I want to
    have it so; 1. My users sign up on my website (easy enough, don't need help with) Now, this
    part might get confusing, but I need major help, as I see no way of doing it, yet I would love for
    it to happen. When they post on my website (comment), (this part I don't need help with), I
    wish for their gamer profile to show up under their name, so It'll say; Nate posted on (date):
    (gamer profile here) blah blah blah the trouble is, I have no idea how to get the ...
  6. Php Search Engine Script For Mysql Database - (11)
    A search engine is provided to facilitate the user with undemanding and clear-cut search options.
    The search facility includes simple search, search by title, search by word/phrase, ect… Thus, the
    user is at a safe distance from the risk of selecting files/folders ambiguously. In addition, a
    history of recent searches can be preserved for future perusal. Now
    day’s visitors have a large option for his needs on internet and so visitors are not vesting their
    time by following the dead links on your site. So a search engine is essential for your...
  7. Html Site With Login - Is it possible? (2)
    Hello. I´m building my own site and I need some help... Is it possible to use a login sistem in php
    and mysql database in a html site? ...
  8. Can Database Column Names Start With A Number? - Can database column names start with a number? (1)
    Can database column names start with a number or must they start with a letter like php vars? Like
    my_table.1fieldname ? Does this vary from db system to db system? Is it considered good/bad form? ...
  9. Displaying Your Phone Number On A Wap Site - (3)
    I have a wap site elitezone.co.za and what i want to add is a code to the index page that displays
    your operator and phone number. Does any one know the coding for this function if so please show me
    here. Help will appriacated. Topic title modified. ...
  10. Php Problems - Clan Web site Problem (3)
    Okay, so I have an old version of Nettek that I would like to modify. There is a bug that when you
    get to the rank required for Set Rank, you can set your rank or other people's ranks to what
    ever you want, even Webmaster and that's something I'd like to not have. I am wondering how
    to fix the problem. What would I modify in the coding to set have it so you can only move people up
    to 1 rank below you at best? I'm still learning PHP and can't modify things like this quite
    yet....
  11. New Arisen Site Problem - Nettek Login Trouble (2)
    Okay, so I installed Nettek and got everything set up. But every time I try and login, it says
    it's incorrect. I've gone into the Database and gotten the password and since it was
    simple, put them in and had tried but with no success. I tried changing the password but I still
    couldn't get in. I tried adding another login and it still didn't work. I have no idea
    what's wrong and I need some help....
  12. Use Bb Code On Your Site! - Just like on forums! (7)
    To use this you must have PHP support on your server. Just use this code: CODE $content =
    "Hello, World!"; $html = array(' ', ' ', ' ', ' ', ' ',
    ' '); $replacements = array (' ', ' ', ' ', ' ', '
    ', ' '); $content = str_replace($html, $replacements, $content); ?> This code can
    be very useful. It can be used for word filters to block the use of bad words on your site or for
    emoticons....
  13. Read Xml And Import Into Database - question (2)
    hi all , i have one big problem i need to know , how i can read xml file and then save strings in
    xml in database for example its my xml CODE 1 2 i want my soruce read this xml
    file and then save string into arash field in mysql database for example in this source arash
    string is " 1" and kiarash string is "2" my fields in mysql are standard and we have 2 field with
    names "arash" and "kiarash" please help me , if you know some tut about this subject thanks
    /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> ...
  14. Cms Opensource - great cms reviews site (1)
    Hello... you can find great cms on http://www.opensourcecms.com <<< there you can find cms like
    mambo,joomla,wordpress,etc <<...
  15. Download Database Backup - Download Database Backup (0)
    Hi all i want write backup system like Phpmyadmin export in single file , my question is what is
    backup query ? i must write manul query for backup for example loop query to get string form
    database and write into one file or php have backup query ? thanks /wink.gif"
    style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> ...
  16. Editing Information In A Mysql Database And Deleting Rows - (5)
    I need help with a couple of things. First, I need to know how to retrieve information from a mysql
    database and edit it then re add it to the database. I also would like to know how to easily delete
    a mysql row. And I want this done without going to phpMyAdmin. Thanks for the help!...
  17. Importing .csv Into Mysql Database - NEED HELP! (6)
    I need help importing a .csv contents into a Mysql database. I have this. But its not working.
    CODE connection = mysql_connect("******", "**********", "********") or die ("Unable to connect
    to server"); $db = mysql_select_db("b9_259782_CC", $connection) or die ("Unable to select
    database"); fopen ('csvranks.csv', 'r'); mysql_query("INSERT INTO test_table (id,
    name, guild, level, exp) ?> What am I doing wrong? The mysql table is all set up.. Any help
    is GREATLY appreciated. If you need more info just ask. Thanks! EDIT: The CSV file looks l...
  18. Beginner's Php Tutorial Online At My Site - (12)
    Hey everyone, over the last week I've been writing a PHP tutorial aimed at absolute beginners
    who have never even seen the syntax of PHP before let alone wrote a PHP script! The tutorial
    assumes you have a basic knowledge of HTML (for the tutorial you will need to write a couple of
    hyper links and forms, nothing complex!) and an internet browser. It tells you about where to find
    the other software needed (apache/XAMPP and a script.text editor) and how to check if it is working.
    The tutorial is basic and focuses on the use of the ECHO, INCLUDE/REQUIRE and IF functi...
  19. Wap Redirection - Usefull code that all wap site owners should use! (12)
    Use this code to redirect pc users from your wap site to web site: include above page header this
    code: CODE $mywebsite = "forum/index.php"; $browser = explode ('/', $HTTP_USER_AGENT);
    if($browser =="IE"){ header ('Location: $mywebsite');} ?> ...
  20. Problem To Join Tables In Database - Problem in joining (many to many) relation (3)
    Please help me. I'm building a group of database fro a program. the situation is like this:
    'user' may have 1 or more class(es). 'class' itself may have 1 or more user in its
    classroom. I'm bad at explaining... maybe like this: A program is made to write data of
    classroom. Hikaru has a math class at Monday and statistic class at Tuesday. The math class itself
    consists of about 50 students in a classroom. So, Hikaru (user ) may have one or more class at
    time, math class (class) may have one or more students at time. So, basically I must mak...
  21. File In Database - Question.thanks (1)
    Hi all i write this code i want when you see download.php (this code) my file goes for download for
    user sorry my english is not very good its a file database project for my university but when i
    browse this code my soruce file (.zip) echo in my page and dont goes for download my next querstion
    about safe mode i saw (php.net and zend) when safemode is on file databaseing and header() is not
    working . is it true ? if is it true i save my file at hosting and no (database) i want write
    standard script . plz help me thanks more and more CODE include("config.php"); $kind...
  22. Code To Install Mysql Database Table? - (5)
    Can anyone show me example code of how to install a database table instead of me having to upload an
    file with it in, so i can do it from a php page? Thanks in advance ;-)...
  23. I Need Webmail On My Server - (so admins on my site can access it) (0)
    Right now, if i go to the cpanel of my site, I can access webmail of any of the email addresses I
    have. Unfortunatly, I would prefer it if the administrators did not know the password to the
    cpanel. I want them to be able to access mail from 1 of the email accounts. I have tried letting
    all the admins access the account through their own cliants, but it became a mess, not knowing wich
    admins have responded to which emails, because most emails are hosted localy when received by
    cliants such as outlook. Then I had the idea of making one page, with webmail on it. Where...
  24. String Search Outside My Site? - Help me work this out please ;-) (2)
    Hi ;-), i need some php code that will search any site or index page for a string. So i can check if
    my link is on sites it should be quickly?...
  25. Posting To An External Site Without Url Change - need help (0)
    I need help with some PHP, once again. What I'm wanting to do is add something to an external
    database from a remote site. Say we are using the script farsiscript posted ( here ), and
    there's an added feature where it saves the information to a database, and it's on a
    different server. I want people to be on my site, enter the variables, and have the information
    submitted without knowing anything about the external site. Also, would there be a way of
    confirming whether the information was submitted, or if there was an error? Like if the result said
    "Than...
  26. The Downloads On My Site - php (8)
    Ok i have a site with these downloads, when you click on them they do not open up to a new window.
    Instead it uses the same window and goes to the link that it was linked to go to. All of my
    downloads are made from being linked to some other site. Now my site is php, so i was wondering how
    i can make all links open up a new window to their download page without having to type out
    target="_blank" for all of them. Which would take awhile for me. I was wondering if there is a way
    to do that with the php download module where i can insert the target="_blank" in there so it w...
  27. Good Script Site - Plz Write Good Script Site Here! (6)
    Hi all I write script and i want to know which Script site for release Script is best Some sites ::
    www.hotscripts.com www.scripts.com http://www.yourscripts.net/ http://www.popscript.com/ If You
    know more Url plz post here . thanks all...
  28. Showing Numbers Of Mysql Entries In A Database Table - It should be easy, but I don't know how... (7)
    I have a database, and need to know how to show the numbers of entries. So, if there are 10 entries
    in the selected database table, it will show the number 10 . I'm pretty sure this should be
    easy, but I don't know how to do it. Can someone tell me? /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />...
  29. Login / Authetication System Using Database - adding information (4)
    Is there any way to make such database where I can write like name and passwords.. Then make an
    login box, and when somebody trys to acces the login he needs to write the name and password.. Then
    it is verifyed if is there such name and password and if it is then acces the page.. I think there
    is posible something like that with MySQL (db).. but can anybody say me a script or way to make
    something like that? Alredy thanks.....
  30. Too Many Connections Created In Mysql By My Site - (4)
    Hi i am hosted at computinghost (which is great btw) but my site is causing mysql to hang because
    it is flooded and it causes my account to be suspended alot.. What is confusing is that not many
    users (7) are only when it happens and it is not a deliberate flooding. The mysql proccesslist when
    it gets too many connections: QUOTE | 7971 | andre_krap | localhost | andre_wap | Query | 439
    | Sending data | SELECT unread,sentby,id FROM private WHERE sentto='Candi.Boi' ORDER BY
    id DESC LIMIT 0,15 | | 7973 | andre_krap | localhost | andre_wap | Query | 2 ...



Looking for connecting, php, site, database
Can You Add
Images Into
A Mysql
Database?
Using Php?
Auto Pruning
An Sql
Database
With Php How
can i do
this?
Ms-access
Database
Question
Allowing Web
Access to
the
Informaton
How Do I
Connect To
Live
Database
With Php
Script?
while being
hosted with
ComputingHos
t
Xbox
Gamertag
Profile On
Site
Php Search
Engine
Script For
Mysql
Database
Html Site
With Login
Is it
possible?
Can Database
Column Names
Start With A
Number? Can
database
column names
start with a
number?
Displaying
Your Phone
Number On A
Wap Site
Php Problems
Clan Web
site Problem
New Arisen
Site Problem
Nettek Login
Trouble
Use Bb Code
On Your
Site!
Just like on
forums!
Read Xml And
Import Into
Database
question
Cms
Opensource
great cms
reviews site
Download
Database
Backup
Download
Database
Backup
Editing
Information
In A Mysql
Database And
Deleting
Rows
Importing
.csv Into
Mysql
Database
NEED
HELP!
Beginner'
;s Php
Tutorial
Online At My
Site
Wap
Redirection
Usefull code
that all wap
site owners
should
use!
Problem To
Join Tables
In Database
Problem in
joining
(many to
many)
relation
File In
Database
Question.tha
nks
Code To
Install
Mysql
Database
Table?
I Need
Webmail On
My Server
(so admins
on my site
can access
it)
String
Search
Outside My
Site? Help
me work this
out please
;-)
Posting To
An External
Site Without
Url Change
need help
The
Downloads On
My Site php
Good Script
Site Plz
Write Good
Script Site
Here!
Showing
Numbers Of
Mysql
Entries In A
Database
Table It
should be
easy, but I
don't
know how...
Login /
Autheticatio
n System
Using
Database
adding
information
Too Many
Connections
Created In
Mysql By My
Site

Searching Video's for connecting, php, site, database
See Also,
advertisement


Connecting Php Site To Database

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com