For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2006 > Resource id #5









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Resource id #5
Bill

2006-10-30, 7:03 pm

Can anyone help. I am trying to build a website using php and css. The
plan was to put all the data into a database and extract it and place
into areas of the webpage.
Used the following code

$sql = "select text from mainpage where mainpageID = 1";
$header = @mysql_query($sql,$connection) or die("cant querry");

then on the webpage where I wanted the text I put
<?php
echo "$header";
?>
Received the message Resource id #5 instead of text.
Is there something I have forgot to do. Or what am I doing wrong.
Thanks for your time

Bill
Andy Hassall

2006-10-30, 7:03 pm

On Sun, 29 Oct 2006 10:58:35 +0000, Bill <bill@tiscali.co.uk> wrote:

>Can anyone help. I am trying to build a website using php and css. The
>plan was to put all the data into a database and extract it and place
>into areas of the webpage.
>Used the following code
>
>$sql = "select text from mainpage where mainpageID = 1";
>$header = @mysql_query($sql,$connection) or die("cant querry");
>
>then on the webpage where I wanted the text I put
><?php
> echo "$header";
>?>
>Received the message Resource id #5 instead of text.
>Is there something I have forgot to do. Or what am I doing wrong.


Read through the example 2 in the manual, which shows all the steps you need
to go through including the missing final step to fetch the data:

http://uk.php.net/mysql_query

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com