Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7914059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:59:31+00:00 2026-06-03T13:59:31+00:00

I have this code: <?php include ‘connect.inc.php’; include ‘header.inc.php’; $mesiace = array(Január, Február, Marec,

  • 0

I have this code:

<?php
include 'connect.inc.php';  
include 'header.inc.php';


$mesiace  = array("Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl",     
"August", "September", "Október", "November", "December");

echo '<div id="rozpis">';
$sql = "SELECT game_id, rival_id, result, h_a, UNIX_TIMESTAMP(datum) AS datum FROM        game ORDER BY datum ASC";
$result = mysql_query($sql, $db) or die("ERROR: ".mysql_error());
if(mysql_num_rows($result) > 0)
{
echo '<table>';
echo   '<tr><td>Dátum</td><td>Domáci</td><td>Hostia</td><td>Výsledok</td></tr>';
while($row = mysql_fetch_array($result)) //here is the problem
{
extract($row);
$prikaz = 'SELECT rival_id, name FROM rival WHERE rival_id = '. $rival_id;
$vystup = mysql_query($prikaz, $db) or die(mysql_error($db));
$rival = mysql_fetch_array($vystup);
echo '<tr>';
echo '<td>' .date("j. F Y", $datum). '</td>';
if ($h_a == 1)
{
echo '<td> Capitals </td>';
echo '<td>' .$rival['name']. '</td>';
}
else 
{
echo '<td>' .$rival['name']. '</td>';
echo '<td> Capitals </td>';
}
echo '<td><a href="zapas.php?zapas='. $game_id.'">' .$result. '</td>';
echo '</tr>';  
}
echo '</table>';
}
else
echo 'No matches';

echo '</div>';

include 'zahlavie.php';
?> 

When I run this script it writes this warning:

Warning: mysql_fetch_array() expects parameter 1 to be resource,
string given in H:\xampp\htdocs\rozpis.php on line 16

I really don’t know where is problem. In the table I have three rows, but it writes only the first one and then this message. When I run $query in phpMyAdmin it runs correctly or when I use echo mysql_num_rows($result) it returns correctly also.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:59:33+00:00Added an answer on June 3, 2026 at 1:59 pm

    The problem is that you are using the function extract and one of your db columns is named “result”. Thus is will overwrite the variable $result with some string, which is of course wrong.

    $sql = "SELECT game_id, rival_id, result, h_a, UNIX_TIMESTAMP(datum) AS datum FROM        game ORDER BY datum ASC";
    $result = mysql_query($sql, $db) or die("ERROR: ".mysql_error());
    while($row = mysql_fetch_array($result)) {
        extract($row); // <- here is the problem
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code : include(connect.php); // Call database function $p = 100; $sth
I have this code: <?php ini_set('display_errors', true); error_reporting(E_ALL); include ../../../wp-load.php; $groups = array(); if
I have this code which will include template.php file from inside each of these
I have this php code $jsonArray = array(); $sql = SELECT ID,CLIENT FROM PLD_SERVERS;
I have this code here: case 'resource_list': if(file_exists('content.php')){ include('../ajax/content.php'); } else { die('does not
I have this code in my header.php for Wordpress to display a mini feed
I have this code: include('./simplehtmldom/simple_html_dom.php'); $url = http://www.turismovenezia.it/Dove-Alloggiare/1322597142.html; $ch = curl_init(); // set URL
I have this code: <?php include(db.php); $result = mysql_query(SELECT * FROM email); while($row =
I have the following code: if (include_once(dirname(__FILE__).'/file.php') || include_once(dirname(__FILE__).'/local/file.php') ) { This causes an
I have this code in PHP. It connects to the DB fine, but pops

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.