Hi,

Installing a new script....

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/13/11394913/html/config.php on line 4

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/13/11394913/html/config.php on line 5

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/13/11394913/html/config.php on line 4

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/13/11394913/html/config.php on line 5

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/13/11394913/html/config.php on line 4

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/13/11394913/html/config.php on line 5


Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/13/11394913/html/index.php on line 35

Index shows up but with errors.

config file

<?php
include "connect.php";  
$settings = mysql_query ('select * from settings'); 
$settingrecord = mysql_fetch_array($settings);    
while ($settingrecord = mysql_fetch_array($settings))
{
    switch ($settingrecord["name"])
    {
        case "sitename":            
        $sitename = $settingrecord["setting"];
        $sitenamesafe = htmlentities($sitename);            
        break;        
        case "adminid":
        $adminid = $settingrecord["setting"];       
        break;       
        case "adminpw":     
        $adminpw = $settingrecord["setting"]; 
        break;   
        case "paypal":
        $paypal = $settingrecord["setting"];   
        break;      
        case "stormpay":
        $stormpay = $settingrecord["setting"];
        break; 
        case "safepay":
        $safepay = $settingrecord["setting"];            
        break;     
        case "solidtrust":
        $solidtrust = $settingrecord["setting"];   
        break;
        case "adminemail":
        $adminemail = $settingrecord["setting"];
        break;           
        case "prointerval":
        $prointerval = $settingrecord["setting"];            
        break;      
        case "basecolour":
        $basecolour = $settingrecord["setting"];  
        break;      
        case "contrastcolour":          
        $contrastcolour = $settingrecord["setting"];            
        break;        
        case "fonttype";
        $fonttype = $settingrecord["setting"];    
        break;       
        case "fontcolour":
        $fontcolour = $settingrecord["setting"];
        break;        
        case "freepost":            
        $freepost = $settingrecord["setting"];            
        break;        
        case "propost":         
        $propost = $settingrecord["setting"];            
        break;        
        case "domain":          
        $domain = $settingrecord["setting"];            
        break;        
        case "com1":            
        $com1 = $settingrecord["setting"];            
        break;        
        case "com2":                
        $com2 = $settingrecord["setting"];            
        break;        
        case "com3":
        $com3 = $settingrecord["setting"]; 
        break;        
        case "com4":   
        $com4 = $settingrecord["setting"]; 
        break;        
        case "com5":    
        $com5 = $settingrecord["setting"];   
        break;    
        case "ups":  
        $ups = $settingrecord["setting"];    
        break;        
        case "adminfee":  
        $adminfee = $settingrecord["setting"];
        break;     
        case "rand": 
        $rand = $settingrecord["setting"];           
        break;        
        case "freecommission" :          
        $freecommission = $settingrecord["setting"];             
        break;        
        case "procommission" :          
        $procommission  = $settingrecord["setting"];            
        break;
    }
}   
if( isset($_SESSION['ulogin']) && $_SESSION['ulogin'])
{
    $userinfo=mysql_query ("select * from members where userid='".$_SESSION[uname]."'");        
    $userrecord=mysql_fetch_array($userinfo);        
    $id=$userrecord["id"];        
    $name=$userrecord["name"];        
    $contact_email=$userrecord["contact_email"];        
    $subscribed_email=$userrecord["subscribed_email"];        
    $paypal_email=$userrecord["paypal_email"];        
    $stormpay_email=$userrecord["stormpay_email"];        
    $safepay_email=$userrecord["safepay_email"];        
    $solidtrust_email=$userrecord["solidtrust_email"];        
    $contact_email=$userrecord["contact_email"];        
    $password=$userrecord["pword"];        
    $userid=$userrecord["userid"];        
    $status=$userrecord["status"];        
    $referid=$userrecord["referid"];        
    $verified=$userrecord["verified"];        
    $solos=$userrecord["solos"];        
    $points=$userrecord["points"];        
    $commission=$userrecord["commission"];        
    $ip=$userrecord["ip"];        
    $joindate=$userrecord["joindate"];        
    $lastpost=$userrecord["lastpost"];        
    $subscribed=$userrecord["subscribed"];        
    $memtype=$userrecord["memtype"];        
    $up=$userrecord["up"];        
    $random=$userrecord["random"];        
    $hits_unique=$userrecord["hits_unique"];    
    $hits_visitor=$userrecord["hits_visitor"];
}
?>

index file

<?php

include "config.php";
$get_referid = $_GET['referid'];
if (!empty($get_referid)) {

    $get_referid = addslashes($get_referid);

    if($_COOKIE['referid']!=$get_referid) mysql_query("UPDATE members SET hits_unique=hits_unique+1,hits_visitor=hits_visitor+1 WHERE userid='$get_referid'");

    else mysql_query("UPDATE members SET hits_visitor=hits_visitor+1 WHERE userid='$get_referid'");

    if(mysql_affected_rows()){

        setcookie('referid', $_GET['referid'], time()+365*24*60*60);

        setcookie('referrer', $_SERVER['HTTP_REFERER'], time()+365*24*60*60);

    }

}



include "header.php";

    echo '<center>';

    $query1 = "SELECT * FROM pages WHERE name='Index (Main) Page'";

    $result1 = mysql_query ($query1);



    $line1 = mysql_fetch_array($result1);

         $htmlcode = stripslashes($line1["htmlcode"]);







    echo $htmlcode;


include "footer.php";

mysql_close($dblink);

?>

Thanks!!
L-D

Dani AI

Generated

Short diagnosis: those warnings mean PHP tried to fetch rows from a failed query (mysql_fetch_array got a boolean). Common causes are a bad DB connection, the needed tables not existing (you mentioned the SQL wasn't uploaded), or permission problems. Also check for a couple of logic/typo issues in the config: fetching a row before entering the loop will skip the first result, and using session keys without quotes can silently fail. was right to suggest surfacing the DB error so you see the real cause.

Quick checklist to work through (do these in order)

  • Confirm connect.php actually connects to the intended database (host, user, password, dbname) and that session_start() runs before reading $_SESSION.
  • Verify the database import completed and that tables like settings, members and pages exist and have rows.
  • Temporarily enable full error reporting while debugging so you get clear messages.
  • Fix array key usage (use quoted keys like $_SESSION['uname']) and remove any needless initial fetch before the loop.

A short, safe example of a modern approach (PDO) to read the settings table and avoid the double-fetch problem:

$pdo = new PDO('mysql:host=localhost;dbname=yourdb;charset=utf8', 'user', 'pass', [
  PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);
$stmt = $pdo->query("SELECT name, setting FROM settings");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
  ${$row['name']} = $row['setting'];
}

phpMyAdmin gzip import error: that message usually means the file is compressed but the server lacks gzip support. Open the SQL file in a text editor — if it looks binary, decompress locally (7‑Zip/WinRAR on Windows, gunzip file.sql.gz or zcat file.sql.gz | mysql -u user -p dbname on Linux) and then import the plain .sql. After import, re-run the page and check any DB error text to find remaining issues.

Recommended Answers

All 5 Replies

Those errors mean that the query failed. My guess is the connect script is using the wrong database credentials.

Interesting... backspace a bit...

This is a revision of a script I had been trying to use... It had old session registered, etc. Now it has been updated. I purchased it (lic) yesterday.

Anyway, I had set up a fresh DB and imported sql. I'll email the script source for help.

Yeah, I know, but I wanted to see what you guys had to say.

L-D

Try this:

$settings = mysql_query ('select * from settings') or die(mysql_error()); 

to get a better error message.

I find it disturbing that someone sells a script that still uses the MySQL extension.

Beats me, but then I don't know the diff.

It looks like I forgot to upload sql. Ok, have a good laugh! I think my hat is too tight!

Here is what I get... (yellow background)

Error
You attempted to load file with unsupported compression (application/gzip). Either support for it is not implemented or disabled by your configuration.

I already unzipped the main folder... I usually upload sql.tex.

Doesn't look like a zipped file but it does say sql.sql rather than txt. What do I do? Is it zipped? How do I crack it open?

The script guy said

"Did you upload your database to the phpmyadmin?

If so did you go to the connect file and put the database info in?

That's what it looks like needs to be done".

So, that's where I'm at.

Thanks for the tip but the problem seems to be out in the open.

L-D

Not sure about your sql file. Can you read it with a text editor?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.