All web pages return http 500 not sure why

Username (e.g. epiz_XXX) or Website URL

epiz_33087480
(please specify the website or account you are asking about)
http://www.deniserose.epizy.com/fetch_sql.php

Error Message

(please share the FULL error message you see)

This page isn’t working

www.deniserose.epizy.com is currently unable to handle this request.

HTTP ERROR 500

Other Information

None of my php pages seem to be running any ideas please ?
Thank you for looking as these run on my previous site elsewhere.

D

Your PHP code could be crashing. See this article for more information:

6 Likes

Hmm, I added my .httpaccess and changed my ‘local host’ but it seems your system doesn’t use $con->Query as its now Boolean also I note differences in getting fetch row not working pulling next row this is different to I guess why can you all use same page book it would make this so much easier with standardisation [rant over] I also notice getPDT($current_playing[‘datetime’]); doesn’t work does this system not support getPDT? or is my whole SQL going to have to change to new msql protocols ?

I can see your website is working.
http://www.deniserose.epizy.com/?i=1

Edwin some of it but not all on wordpress. I cant find some url in it that point to old crap site .i am also having to try get data together from oddments as old site serer people does not understand Information Act and trashed my site. I migrated what I could so far but /wp_login wont work idk. I didn’t know my old server didn’t support Php 8 so have not written it for that but it used too on there crap service server . This one seems much better. It also doesn’t seem to have uploaded data yet .

I still have to work out why i cant have echo “spade “.” bucket”; I don’t understand explanation given I think I need ‘new msql()’ etc for php 8 ?

Hugs D

1 Like

Am also having problems with :slight_smile:

$time = date(‘H:i:s’,$datetime1);
$newDT = getPDT($row[‘datetime’]);

Do these not exist on this server ?

I don’t think this is a function… if you’re looking for the Pacific Timezone, use date_default_timezone_set('America/Los_Angeles'). If that’s not it, please elaborate .

$datetime1 is not defined, $row["datetime"] is not defined.

5 Likes

It supposed to be simple right now.
The hardest question is You need to login your wp-admin on infinity free.
Since there a crush though on wp-admin login. You should upload your files manually. You can use filezilla or filemngr. Why you need to login on wp-admin ? You can replace your wp-admin login by doing thoze stuff on localhost. Upload the result file then.

Hi Wacky thanks but
I am also trying to convert data from sql to Pacific Date Tim a in $newDT = getPDT($row[‘datetime’]); which fails as its unix from my old site . Can you help on how to convert it without unix GetPDT(

Thank you very much for your help
D

I told you:

Just put this at the top of your php file.

3 Likes

Yes but had this why does it give error Notice : Undefined variable: current_playing in /home/vol1_2/epizy.com/epiz_33087480/htdocs/music_now_playing.php on line 197 because I call it please ?

function getPDT($datetime2) {
    // ****************** time zone things not used currently shows GMT
    //$baseTimezone = new DateTimeZone('CST'); // Central Standard Time Zone -6
    $baseTimezone = new DateTimeZone('America/Denver');         // timezone of datetime on DB
    $userTimezone = new DateTimeZone('America/Los_Angeles');
    $DBDate = new DateTime($datetime2, $baseTimezone);
    $DBoffset = $baseTimezone->getOffset($DBDate);
    $userDate = new DateTime($datetime2, $userTimezone);
    $USERoffset = $userTimezone->getOffset($userDate);
    // create a DateInterval Object with the corrected difference between DB and required
    $myInterval = new DateInterval('PT'. abs($DBoffset - $USERoffset) . 'S');
    if ( $USERoffset < $DBoffset) {
        $myInterval->invert = 1;
    }
   
    return  $DBDate->add($myInterval);
 
}

It also gives error on same line http://www.deniserose.epizy.com/music_now_playing.php 197: $newDT = getPDT($row[‘datetime’]);

got it.
Share your fetch sql please ?
Hide credential.

That means you are calling $current_playing, but the interpreter does not know what $current_playing is. You need to define it before you can use it.

Why do you need that? This issue is not related to SQL

3 Likes

I try to resolve another problems out from this issue. She had sql fetch problem too. tough.
You wanna make time variable use mktime().

You wanna make time variable use mktime. How to delete

Ok here is my login fetch bits as requested Edwin . it all parses a php app to check syntax Hopefully you will see something I cant and please enlighten me ?

$con = new mysqli($servername,$username,$password,$dbname);
if ($con -> connect_errno) {

echo "Failed to connect to MySQL: " . $con-> connect_error;;
}else{
echo "";
}

sql = "SELECT `datetime`,`artist`,`song`,`album`,`comment` FROM `played_songs` ORDER BY `datetime` DESC";



$result = mysqli_query($con, $sql);

 $n=0;
 if($result->num_rows>0)
 {
	$current_playing =  $result->fetch_assoc();

while($row=$result->fetch_assoc())
	{   
		$n++;
                // etc.
        }
 }

Hope this helps thanks everyone D :slight_smile:

I checked your code and I see a potential issue.

On line 195 of the music_now_playing.php is a closing curly bracket. That means that all code below that will execute even if $result->num_rows>0 returns false (which means no rows were returned and the $current_playing = $result->fetch_assoc(); line was never executed).

Judging by the indentation, I think that closing bracket should be around line 250.

4 Likes

I try your code. It didn’t work. I still searching why?

Can you fetch with pdo like this:


try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$sql = 'select .…;
$q = $conn->query($sql);
$i_count = $q->rowCount();
echo "row: " . $q->rowCount();
$q->setFetchMode(PDO::FETCH_ASSOC);
} catch (PDOException $pe) {
die("Error occurred:" . $pe->getMessage());
}
$conn = null;
?>
<?php while ($r = $q->fetch()): ?>

<?php
  echo $r['song'];
?>

<?php endwhile; ?>

make it same form:


try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);

$sql = 'select ...';
$q = $conn->query($sql);
$i_count = $q->rowCount();
//echo "row: " . $q->rowCount();
$q->setFetchMode(PDO::FETCH_ASSOC);
} catch (PDOException $pe) {
die("Error occurred:" . $pe->getMessage());
}
$conn = null;
?>
<?php
 $n=0;
 if($i_count>0)
 {
	//$current_playing =  $result->fetch_assoc();

    while ($r = $q->fetch()):
       $n++;
     	echo $r['artist'] . " " . $n . "<br>";
    endwhile;
 }
 
 ?>

Hmm I keep getting this error Parse error : syntax error, unexpected ‘}’, expecting end of file in /home/vol1_2/epizy.com/epiz_33087480/htdocs/music_now_playing.php on line 177 on line p 238 this is closed so cant see the error why it says ‘}’ in unexpected are they not supposed to be balanced? Or is the something wrong with the PDO code I inserted?

1 Like