Go Back   Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum > Support > php issues.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-13-2007, 03:35 PM
Member
 
Join Date: Nov 2007
Posts: 30
Wink site search and databases

Hi huys. I'm just wondering. At the moment my company has its own servers to host our site. We are now considering moving it. I'm most probably going to get it hosted here because I've heared good things about the service and reliability...Anyhow my main issues are whether the code I use for connecting to databases will work the same as it does now. I just use the standard code like this
$database = "db1";
mysql_connect();
@mysql_select_db($database) or die("Unable to select database");
$query="SELECT * FROM dbtable5 WHERE code = $code";
$result = mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
$name = mysql_result($result, $i, "name");
$entered = mysql_result($result, $i, "entered");

would this work ok? No reason why it shouldn't unless I need to enter server names and passwords...
My only other issue is that I use php dig for our site search feature...I'm wondering if there is a similar in built search programme I can use to replace it as I would not have it installed anymore? Thats if I get the standard shared hosting anyway (because I'm aware that with vps or dedicated server I could get anything installed)
Reply With Quote
  #2 (permalink)  
Old 12-13-2007, 08:45 PM
Administrator
 
Join Date: Mar 2006
Posts: 1,702
Default

Hello Shaun,

Your database connection string is perfect and you need to replace database name, database username and password in your code to establish connection with your database.

We can provide you with PHPDig on our servers but you will need to take care of scripting as we can provide you with platform but scripting has to be sorted from your end.
__________________
Web Hosting UK - ASP MSSQL Hosting - cPanel Linux Hosting
AIM : webredback || msn : andrew @ webhosting.uk.com
Toll Free : 0808 262 0855
Reply With Quote
  #3 (permalink)  
Old 12-14-2007, 09:13 AM
Member
 
Join Date: Nov 2007
Posts: 30
Default

right. Well as mentioned I have php dig on our site at the moment. So if I simply copy its web folder and use it then it might well work? I'm not a heavy php coder thats the problem. And this is fairly heavy stuff. I only use php for database connectivity and the include function really.

So yes, the database stuff..I thought I might have to input username and passwords. We obviously dont have that at the moment. But will I have to create a username and password? I know its recomended, but for the sake of changing pages and pages of code I would rather not......
Reply With Quote
  #4 (permalink)  
Old 12-15-2007, 08:40 PM
Administrator
 
Join Date: Mar 2006
Posts: 1,702
Default

Hello Shaun, You should use a username and password as that will be safe for your database. You should not use root user as default. You can simply copy your code on our servers and that should work. If you face any problem in making it work then we are here to fix it.
__________________
Web Hosting UK - ASP MSSQL Hosting - cPanel Linux Hosting
AIM : webredback || msn : andrew @ webhosting.uk.com
Toll Free : 0808 262 0855
Reply With Quote
  #5 (permalink)  
Old 12-17-2007, 09:33 AM
Member
 
Join Date: Nov 2007
Posts: 30
Default

Sorry for being a bit dense, but what do you mean by "root user"? So the code will work fine as it is then? only with no password and username protection? My only other query is the php dig problem I have.....You say that you have it available, so will my php dig code work fine? I dont know if it requires some sort of installation with my account to work thats all.
Reply With Quote
  #6 (permalink)  
Old 12-17-2007, 02:24 PM
Member
 
Join Date: Mar 2007
Location: Bristol, UK
Posts: 32
Default

For security your database should have a username and password. Otherwise anyone can connect to it and retrieve/submit data. Also if you're storing any personal information on the database its a legal requirement that it is secured.

If you're currently using no username and password then your code will have to be modified because whuk requires database servers/databases to have a username and password.
Reply With Quote
  #7 (permalink)  
Old 01-17-2008, 01:46 PM
Senior Member
 
Join Date: Jul 2007
Posts: 132
Default

Quote:
Originally Posted by Administrator View Post
Hello Shaun, You should use a username and password as that will be safe for your database. You should not use root user as default. You can simply copy your code on our servers and that should work. If you face any problem in making it work then we are here to fix it.
This doesn't mean they will rewrite your script for you. (in view of your limited php knowledge) But if you PM some of the members who do have php knowledge, most of us do try and be helpful.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:08 AM.
Copyright 2002-2007 WebHosting.uk.com. All rights reserved.
Web Hosting UK Forum