i've solved that, but now I want to read the text from the mySql db and display in that page.
i keep gettin a error :
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\phpdev\www\dev\compulearn\in work\main.php on line 18
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\phpdev\www\dev\compulearn\in work\main.php on line 19
heres what ive done. Can sumone solve this
----------------------------
<?php
include ('include_fns.php');
include ('header.php');
include ('left.php');
include_once('db_fns.php');
//connect to the MySql Database
$conn = db_connect();
$sql = "select * from stories
where page = '$pages'
and published is not null
order by published desc";
$result = mysql_query($sql, $conn);
while ($story = mysql_fetch_array($result))
{
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\phpdev\www\dev\compulearn\in work\main.php on line 18
Access denied for user: 'content@127.0.0.1' (Using password: NO)
ive no user or password on the db.
this is whats in the db_fns.php which is inlcuded once in main.php
<?php
//connect to database and retreive info from tables
function db_connect()
{
$result = @mysql_pconnect('localhost', 'content', '');
if (!$result)
return false;
if (!@mysql_select_db('content'))
return false;
return $result;
}
function get_story_record($story)
{
$conn = db_connect();
$sql = "select * from stories where id = '$story'";
$result = mysql_query($sql, $conn);
return(mysql_fetch_array($result));
}
?>
i then removed the usr and pass stuuf to:
<?php
//connect to database and retreive info from tables
function db_connect()
{
$result = @mysql_pconnect('', '', '');
if (!$result)
I'd watch while ($story = mysql_fetch_array($result)) - it looks like you might be assigning a new value to $story. Is there a comparison operator, like == ?
i wrote this one, and get no errors, but it wont display anything . It will coneect to the db, cause if i change stuff in the dbconnect.php, it displays unable to connect to db, which is the custom error i put in. I have changed db's to make sure i didnt make a mistake in creating the db, but still nottin. Whats wrong with the script?
<?php
include('dbconnect.php');
include('header.php');
$result = mysql_query("select * from message")
or die (mysql_error());
PHP doesnt really support html stuff, so have alook at this
www.compulearn.ie and see the text, with the picture, how do i get php to display exactly like that, but php gets it from mysql.
what kinda code would i have to put into mysql for php to display like that,
ive made the menu bar on the left part of the header.php, but php puts the text from mysql underneat that, how do i get php to put the text where it is on the website, do i have to put like <<maintext>> thing in so it will place the text there ?
i have drawin a diagram below to show what happens when my sql print the text. I have a header and left bar, named header.php ( includes the left bar) and it puts the text under all that as shown.
+--------------------------------------------------------+
| |
| HEADER |
+---------+----------------------------------------------+
| Home |
| News |
| Links |
| Contact|
| Join Us|
| Login |
| Register|
+----------+
TEXT ENDS UP DOWN HERE
But i want it like this
+--------------------------------------------------------+
| |
| HEADER |
+---------+----------------------------------------------+
| Home | I WANT THE TEXT TO GO HERE LIKE
| News | THIS BUT IT WONT DO IT FOR ME !!!!
| Links |
| Contact|
| Join Us|
| Login |
| Register|
+----------+
Can someone tell me y mysql puts the text down under everything??
I also want to have a admin interface to edit that e.g.
A text box and a edit button and it will change the text.