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. .
convert static html data into dynamic
hi alli need to convert a website which has static above 2000 articles into dynamic and add that data into database. one solution i know is copy and paste it manually.is there any other formula or
Echoing a Variable from a Object
How do I get a variable from the new User Class to echo out in this clasS?class MyApp{ function __construct() { global $dbHost; global $dbUser; global $dbPass; global $dbName; $this->DB =
exclude characters from counting?
Hello, I wanted to ask if you have a string like:Code: $my_s='ASRGREGTGTR----REGREGRE+++RRRRRR....';is there a way to count the length of the string, excluding non-word characters (+,- or .)?thank you
fwrite error
Hi All,Does anyone know what is causing the error in this code?Code: <?$errorLog_FilePath = "error_log.txt";$handle = @fopen($errorLog_FilePath,'a+');$strError =
Require select-option functionality in Module Pool Programming
Hi Gurus,
Can we convert non uni code system into unicode
Hi All,
Retreiving objects from Sessions
Hi all,I am getting really frustrated with storing and retreiving objects from a session. But it may be because of my lack of knowledge in sessions First some system specs:OS - Vista Home
cURL proxy
Okay here is the thing... i know how to add proxysCode: curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);curl_setopt($ch, CURLOPT_PROXY,"[i][b]PROXYHERE[/b][/i]");Here are my questions..
Help with setcookie()
Merry Xmas to those on this foruumOlder guy here with some experience but not allot so please be gentle.I am having problems with setting cookies on my web site. At one time they worked and for the
Grids not displaying decimals, and behaving differently on different PCs?
Hello,