You are here: Re: include.. but it doesn't! « PHP Programming Language « IT news, forums, messages
Re: include.. but it doesn't!

Posted by Toby A Inkster on 06/14/07 12:26

vinnie wrote:

> <?php
> function connect()
> {
> // SERVER connection
> $con=mysql_connect('host', 'My_user_ID', 'My_Pwd');
> // DB selection
> $sql=mysql_select_db('Database_name');
> }
> ?>

<?php
function connect()
{
// SERVER connection
$con=mysql_connect('host', 'My_user_ID', 'My_Pwd');
// DB selection
$sql=mysql_select_db('Database_name');

return $con;
}
$con = connect();
?>

If you don't understand this, please read the PHP manual -- the part which
explains what a function is and how they work. Read the bits on variable
scope too.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 110 days, 20:10.]

URLs in demiblog
http://tobyinkster.co.uk/blog/2007/05/31/demiblog-urls/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация