I am trying to connect to database using a funciton in a functions.php
<?php
function connect_db_Blog (){
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("blog",$con);
}
?>
which I then include with
include ("scripts/php_functions.php");
but when I run a code with
connect_db_Blog();
var_dump($db);
if (!$db) {
echo "sorry, cannot connect to database";
} else {
here comes some code..
I get: sorry , cennot connect to database message.
when I listen for $db with
var_dump($db);
I get int(0);
instead of int(1) which is needed to proceed with the code.
If I just try to connect to database without the include I dont get the error message i.e. .
Final year project, please point me in the right direction
hi there for my final year project I'm aiming to build a php script shell to use as an expert system ( I got a feeling this is gonna be difficult, VERY )The idea is that i create txt / csv file with
delete comma
HI,How to delete "," at the end of the string.Code: $match = 2009/02/03/a2correx03cvbnm,echo preg_replace("/;$/", "HI", "$match");
Changes to hosting company's server has affected web contact form
I started a thread a couple of months ago about the contact forms on my client's website. Basically he wants me to overhaul the SEO on his site. However, there were problems with the PHP contact forms
Undefined Variable: PHP_SELF, pls help
Hi,Im a newbie on PHP / MySQL programming and Im running a script to search one field on my DB table. The results will show after I key in my search word but there's an error below that says:
How to validate from 2 possible answers
Hi I hope somebody can help me with what will probably be really simple, I'm pulling my hair trying to get my head round it.I've got a contact form and I would like to add to it a couple of simple
whats wrong with my code please help!!!
this is the errorWarning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /var/www/IpSearch.php on line Code: <?php$srch = $_REQUEST["srch"];if (empty($srch)) {
how to insert value
I am having file bookissueadd.php..... in which i am having tag <td height="21">Issue Charges</td> <td><div
Preventing SQL Injection
I have a question about SQL Injection, In some of our code we use this:
Forum tutorial
Im a beginner in PHP. Im making a forum(previous questbook, counter and few others) to learn. For now I know something. I started making the forum from this
How to calculate days from variable date?
This will be easy for one of you gurus. I want to fetch the date from a variable date, for example:Code: <?php$mydate = "";$daysaway = 400;$startdate = "5/5/2005";//I need