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. .
Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :if (isset($_POST['sub1'])) { $id = $_POST['cscstest']; $qty = $_POST['cscsqty']; $id =
Display certain image depending on time of year
Hi, I am new to these forums and would really appreciate some advice on a piece of coding I have done.Basically what I am trying to do is on our intranet, display a different home page banner
Multidimensional $_POST
HelloHow to get a single array from array of array (2 - dimension).For example I have a form:Line number On/Off | Expand/Contract <input type="text"
How to store checkbox array in a session, and then be able to add to it?
I'm trying to store an array of checkbox values into a session array, sort of like a shopping cart, but I can't figure out how to not overwrite the sessions array each time new checkbox values are
pspell
using pspell, is it possible to get words that would be best in the current phrase?For example take this phrase: who is the fastest pwrson in the world?The word person was misspelled as the person
Advice on how to delete a mysql row using my form
Hi,I am very new to php and am struggling to work out how to delete a portfolio item (a row from my database using my form which is here):
PHP4 to PHP5 Conversion
Hi Everyone,I am working on a site that is built up on PHP4 and each page is being started from <? instead of <?php as of PHP5.I want to convert this <? to <?php on every
Unexpected T_Variable ?
Hi all,I dont really know what I am doing!! I know I'm doing something wrong, and I know its on line 42 "$sql="select pname, award, aw_year" but I dont know why its a problem?? Can
Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time around I'm having terrible luck. Basically, I made the crappiest login system ever. I'm using
Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a variable where things starts to go weird. I need ideas on how to solve this.It is not picking up