Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 06-20-2006, 05:57 PM
Corporal
 
Join Date: Apr 2006
Location: Johannesburg, South Africa
Posts: 11
Send a message via Skype™ to theog@discovery.co.za
Default PHP MYSQL Query to HTML in BlueVoda

Hi
I am trying to add a php script which queries a mysql table for my hit counter. When I upload the whole script as a seperate page to my website it works, but I'd like to integrate as html on my main website page just to see the counter.
I've included the script, any help would really be appreciated.
Thanks
Theo

include('config.php');
$date = date("d-m-Y" );
$time = time();
$select = "SELECT * FROM " . $pre . "counter WHERE ip = '$ip' AND date = '$date'";
$query = mysql_query($select);
while($l = mysql_fetch_object($query)){
$time2 = $l->time;
if($time2 > $time - $Dtime) $noentry = 1 ;
}
if(!$noentry){
$insert = "INSERT INTO " . $pre . "counter (ip, date, time) VALUES('$ip', '$date', '$time')";
$query = mysql_query($insert) or die(mysql_error());
}
$select = "SELECT * FROM " . $pre . "counter";
$query = mysql_query($select);
$num = mysql_num_rows($query);
$iparray = array();
$i = 0;
while($l = mysql_fetch_object($query)){
$ip2 = $l->ip;
$isin = 0;
$count = count($iparray);
if(!$count) $isin = 0;
for($j = 1; $j < $count + 1; $j++ ){
if($iparray[$j] == "$ip2") $isin = 1;
}
if(!$isin){
$i++;
$iparray[$i] = "$ip2";
}
}
$count = count($iparray);
echo "Hits: " . $num . "<br>";
echo"Unique hits: " . $count;
echo'<br /><a href="image.php">This month\'s chart</a>';
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 06-20-2006, 08:45 PM
Watdaflip's Avatar
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,638
Default Re: PHP MYSQL Query to HTML in BlueVoda

Just create a html box in blue voda, enter in that complete php script. In the page properties change the file to have a .php extension and publish the page. Change any links to reflect the change from a .html to a .php extention and it should work
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 06-22-2006, 06:00 PM
Corporal
 
Join Date: Apr 2006
Location: Johannesburg, South Africa
Posts: 11
Send a message via Skype™ to theog@discovery.co.za
Default Re: PHP MYSQL Query to HTML in BlueVoda

Hi
Thanks for that info, it worked! Problem is now I don't know how to change my site to using index.php in stead of index.html. I tried deleting index.html using the FTP manager, it's gone, but my default home page still opens the html page and not the php page.
Any help would be great
Theo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 06-22-2006, 08:13 PM
Watdaflip's Avatar
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,638
Default Re: PHP MYSQL Query to HTML in BlueVoda

Make sure that there is only a index.php in the directory. if you type in

www.yoursite.com

It will attempt to open index.html first, if it doesn't exist, it will check for index.php and use that if it exists.

If you are still having issues then recreate index.html, and enter this on it

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=index.php">

This will do an automatic redirect to index.php when index.html loads
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 06-25-2006, 11:22 AM
Corporal
 
Join Date: Apr 2006
Location: Johannesburg, South Africa
Posts: 11
Send a message via Skype™ to theog@discovery.co.za
Default Re: PHP MYSQL Query to HTML in BlueVoda

Thanks for your help, that works!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 07-14-2006, 08:06 AM
Corporal
 
Join Date: Apr 2006
Location: Johannesburg, South Africa
Posts: 11
Send a message via Skype™ to theog@discovery.co.za
Default Re: PHP MYSQL Query to HTML in BlueVoda

Hi
I am trying to adapt the code you gave me to re-direct my site to index.php. I have another domain, where the previous one is question is .com, this one is .co.za . I would only like to have one page on my .co.za domain, which redirects to the .com one. If I use the script as is my index.html on .com domain, it redirects to the following: http://www.sawelder.co.za/www.sawelder.com/index.php I just need it to go to www.sawelder.com, from www.sawelder.co.za .
Excuse my ignorance, but I am very much a newby.
Kind Regards
Theo Groenewald
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old 07-14-2006, 08:30 AM
Major
 
Join Date: Sep 2005
Location: heavenly-temple
Posts: 430
Send a message via Yahoo to Nyoman
Default Re: PHP MYSQL Query to HTML in BlueVoda

it should work. write your full Url address include http://

Code:
 
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://www.sawelder.com/index.php">
or you can set your sawelder.co.za domain as a parked domain in control panel
__________________
.
.
Nyoman
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old 07-14-2006, 02:17 PM
Corporal
 
Join Date: Apr 2006
Location: Johannesburg, South Africa
Posts: 11
Send a message via Skype™ to theog@discovery.co.za
Default Re: PHP MYSQL Query to HTML in BlueVoda

thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


All times are GMT +1. The time now is 03:45 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2005-2009 VodaHost Web Hosting Your Perfect Web Host - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176