Hi All,

I am trying to echo the held text in the "Title" field where the id has a fixed value of 1, but i am getting the following error:

supplied argument is not a valid MySQL result resource in C:\wamp\www\index.php on line 46

your help would be greatly appreciated.

the php code that i am using is:

<?php 
$sql_query = "SELECT 'id', 'Title' FROM 'indexinfo' WHERE 'id' = '1'"; 

//store the queried cell in the variable 
//named $result 
$result = mysql_query($sql_query);  

//display the queried cell 

$row = mysql_fetch_array($result);  // line 46
echo ($row['Title']);

 ?>

Romove the single quotes with table name(i.e. for indexinfo) and give the tild operator like this:`indexinfo`.I think you will get the result.And other this is its not necessary giving braces for echo statements.
It can be like this:echo $row;

Hi thanks for the response.

I amended the code to the following, but I still recieve the same error.

<?php 
$sql_query = "SELECT `id`, `Title` FROM `indexinfo` WHERE `id` = 1"; 

//store the queried cell in the variable 
//named $result 
$result = mysql_query($sql_query);  

//display the queried cell 

$row = mysql_fetch_array($result); 
echo $row['Title'];

 ?>

Hi Thanks so much for your help,

Your advice was perfect, along with me discovering i was referring to the wrong database :-(

Very much appreciated

regards

Paul

This question has already been answered. Start a new discussion instead.