-
December 1st, 2012, 03:15 PM
#1
[Help] Page not displaying at all, when php code connects to MySQL Database
I have no idea what's wrong. I need personal help, I have next to 0 experience with PHP or MySQL. If someone could help me over skype or Teamviewer I'd be very grateful.
-
December 1st, 2012, 09:48 PM
#2
Re: [Help] Page not displaying at all, when php code connects to MySQL Database
Typically in a forum, you state what your problem is. Please do so...
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
December 1st, 2012, 09:56 PM
#3
Re: [Help] Page not displaying at all, when php code connects to MySQL Database
Originally Posted by PeejAvery
Typically in a forum, you state what your problem is. Please do so...
Page goes blank when i upload all these files to it. Also viewsource: displays no code.
PHP: http://pastebin.com/M9xyAVeX
My main page (that won't display correctly): http://pastebin.com/PxgbRVNg
-
December 1st, 2012, 10:08 PM
#4
Re: [Help] Page not displaying at all, when php code connects to MySQL Database
If a server is displaying blank output, then you have server-side errors. Look at the PHP log.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
December 1st, 2012, 10:18 PM
#5
Re: [Help] Page not displaying at all, when php code connects to MySQL Database
There is no php error log displayed in the directory in which the php is being executed. :\
-
December 3rd, 2012, 12:16 AM
#6
Re: [Help] Page not displaying at all, when php code connects to MySQL Database
There is no set location for it. You'll have to check the php.ini configuration file to see where it resides.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
December 5th, 2012, 12:29 PM
#7
Re: [Help] Page not displaying at all, when php code connects to MySQL Database
While access the php in the server I face error as shown below
root@ [/home/microsof/public_html/generate]# php index.php
Notice: Undefined index: REMOTE_ADDR in /home/microsof/public_html/getcodes/functions.php on line 92
This is all the code in my functions.php file.
PHP Code:
<?php error_reporting(E_ALL); ini_set('display_errors',1); function getRandomString($length) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $string = '';
for ($i = 0; $i < $length; $i++) { $string .= $characters[mt_rand(0, strlen($characters) - 1)]; }
return $string; }
function new_ref() { $userip=$_SERVER['REMOTE_ADDR']; $query="SELECT * FROM cookie_ref_ips WHERE IP_address='$userip'"; $exe=mysql_query($query); $num=mysql_num_rows($exe) or die(mysql_error()); if ($num==0) { $refval=getRandomString(10);
$query="SELECT * FROM cookie_ref_ips WHERE REF_val='$refval'"; $exe=mysql_query($query); $num=mysql_num_rows($exe) or die(mysql_error()); if($num==0) { $query="INSERT INTO cookie_ref_ips(IP_address,REF_val) values('$userip','$refval')"; mysql_query($query); $query="INSERT INTO cookie_ref(REF_hits,ip,REF_val) values('0','$userip','$refval')"; mysql_query($query); } } $query="INSERT INTO cookie_ref(IP_address,REF_val) values('$userip','$refval')";
}
function dbConnect() { // update this to your db details mysql_connect('localhost', 'microsof_user', 'cupcake123')or die(mysql_error()); mysql_select_db('microsof_database')or die(mysql_error()); } function get_link() { $userip=$_SERVER['REMOTE_ADDR']; $query="SELECT * FROM cookie_ref_ips WHERE IP_address='$userip'"; $exe=mysql_query($query); $exe2=mysql_fetch_array($exe) or die(mysql_error()); $referal=$exe2['REF_val'];
return $referal; }
function update_hits() {
if(isset($_GET['ref'])) { $ip=$_SERVER['REMOTE_ADDR'];
$ref=$_GET['ref'];
$query="SELECT * FROM cookie_ref WHERE REF_val='$ref'"; $exe=mysql_query($query); $result=mysql_fetch_array($exe); $Oip=$result['ip']; $hit_temp=$result['REF_hits']; $hit_temp++;
if($ip!=$Oip) {
$query="UPDATE cookie_ref set REF_hits='$hit_temp' WHERE REF_val='$ref'"; mysql_query($query); }
}
}
function count_hits() { $userip=$_SERVER['REMOTE_ADDR']; $query="SELECT * FROM cookie_ref WHERE ip='$userip'"; $exe=mysql_query($query); $result=mysql_fetch_array($exe) or die(mysql_error());
$count=$result['REF_hits'];
return $count;
}
?>
Last edited by thepokemon; December 5th, 2012 at 12:32 PM.
-
December 5th, 2012, 10:26 PM
#8
Re: [Help] Page not displaying at all, when php code connects to MySQL Database
Since you have error reporting set to its highest level, it's going to fail on the smallest thing. In this case, it's because of server configuration using predefined variables. Although I have no clue why that one is...
Try changing the error reporting to 0 instead of all, just for a test...
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|