0

please help me to this issue. its driving me nuts for an hour :(

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web033/b336/ipg.asiahomecom/tile/tilesCollection.php on line 16

my line 16 code:

while($row=mysql_fetch_array($a)){

my code..
--------------------tileVerification.php----------------------

<?php
session_start();
if (!$_SESSION['user']){
    header('location: tiles.php');
    exit();
    }
?>

---------------------connectionIn.php-------------------------

$con = mysql_connect("localhost","asiahomeConnect","111")or die("cannot connect");
$db = mysql_select_db("asiahomedb")or die("cannot select Database");

---------------------connectionOut.php-------------------------

mysql_close($con);

---------------------tilesCollection.php------------------

<?php
include("tilesVerification.php");
include("connectionIn.php");
?>
<html>
    <head>
        <title>TILE COLLECTION
        </title>
    </head>
<body>
    <form id="logInForm" name="logInForm" method="post" action="">
    <table width="638" height="119" border="0" align="center" cellpadding="2" cellspacing="0">

<?php
$a=mysql_query("SELECT * FROM tiletbl");
while($row=mysql_fetch_array($a)){ 
    $tile_pic_name=$row['tile_pic'];
    $tilePicture = "img/".$tile_pic_name;
    print "<tr>";
    print "<td width='125'><img src='".$tilePicture."' width='100' height='100' border='0'></td>";
    print "<td width='229'>name:".$row['tile_name']."<br>series:".$row['tile_series']."<br>finished:".$row['tile_finish']."<br>size:".$row['tile_size']."<br>add:<br></td>";
    print "<td width='122'>download<br>edit<br>delete</td>";
    print "<tr>";
    }
?>
<a href="tilesLogout.php">log out</a>
    <p align="center">&nbsp;</p>
        </table>
    </form>
<?php
include("connectionOut.php");
?>
</body>
</html>

Edited by pyTony: fixed formating

2
Contributors
7
Replies
9
Views
5 Years
Discussion Span
Last Post by momonq1990
0

actually my script is work ok on localhost, but after i upload to server. they give me that error

0

The error means that the query was not sucessfully completed. So make sure that the $a actually is a mysql resource or not. For instance, does tiletbl exist?

0

how can i sure that $a is a mysql resource? yes my table is exist..

0

Also you should use mysql_num_rows to check whether you got an empty result set. Look up that function on php.net.

0

yes found it! thanks websitetheme great idea. i forgot to upload my db in my hosting so why its works localy only. thank you!

0

Also you should use mysql_num_rows to check whether you got an empty result set. Look up that function on php.net.

thanks for idea!^^

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.