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. .
Disable html within defined tags
I have a mysql database that allows users to enter content with html, but I also want to have a tag that will disable the html between it for example:<a
Why do I get this error
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/a5488351/public_html/bbdemo.php on line 90Code:<?php session_start(); ?><?php require
adding 0 to numbers
Hey guys i need to create a 00001 number in a loop. Is there a better way of forcing a 5 digit number then counting them and adding the missing zeros?
radio button reamains checked
Hello i'm trying to keep the state off my radio buttons so it shows which ones where clicked after the submit button is clicked im new to this so bare with me.heres my code <?phpforeach($_POST
foreach and array need help combining
Hi guys.Here's the codeCode: array( 'tag' => 'code', 'type' => 'unparsed_content', 'content' => '<div
Character increment
Hi,I am facing a scenario like above,but in my case i want to show up like Col A,Col B etc....The container where i am displaying this is being dynamically generated using jquery.Any help?
mail() says sent but no email received
My code is quite simple:Code: <?php$to = "Ty44ler@yahoo.com";$subject = "Test mail";$message = "Hey, I just wanted to see if the script worked.";$from =
Batch update record with Pagination
Hoping someone can help me with this issue I'm having, im trying to batch update records from a result set with pagination. The first page results (first 10 records) will update with the batch, but
form problem
Hi all, I think this is going to be easy to resolve but for I have been looking at it to long and I cannot see my issue!I hope this is in the right section as it uses modalbox, however I think its a
generate seo frienly url from a text like wordpress
Convert: "åäö" to "aao", "space" to "-", "!?" to "nothing", and all to lower case.function MakeSeo($string){ ???}i want a php