How would you pull the title out of a table in PHP, i tried
<?php echo('$title'); ?>
which down below i have said what title is, how ever it display the file name instead.??
It is probably because $title is undefined. You must put a value in this variable before you try to print it's contents.
Just use a simple select statement and mysql fetch.
Remember, later in the script, if you already have a mysql connection, there is no need to establish another one.
I have title defined later in the script...
Question: If you have opened a connection, and open another, does this slow the connection?
by opening a connection do you mean:
when you give ur username and password or something else?
Yep, mysql_connect or pconnect. You should never need to use the pconnect twice in a script.
Having more than one connection wont be noticable unless your site gets busy.. but remember when you have more than one, there is always going to be more memory needed than is necessary.
btw; if you need the $title defined before you use it..
$title = "hello world!";
would return nothing..
$title = "hello world";
would return hello world.
Hope I understood / explained that correctly
I got it.
ONe more question, should u use something at the end of a script to free memory or something?
You can use mysql_free_result, but PHP automatically does it when the script ends, so I dont bother
mysql_free_result (int result)