Jump to content

[Help] Little issue


Go to solution Solved by Ch0cu3r,

Recommended Posts

Well, my website is not reading the "config.php" page , so its not going to "data base" :/ can someone help me out , why is not ? its probably a easy thing to correct to someone who knows :3


sry about my english, and I hope I posted this in the right place.

 

 config page only have this 

 

<?php
@session_start();
$connectdb=mysql_connect("localhost","7milimetros","Chetan123");
$usedb=mysql_select_db("7milimetros",$connectdb);
$_SESSION['token']=session_id();
?> 
 
Is something wrong here? the data base is called "7milimetros" ...
Link to comment
https://forums.phpfreaks.com/topic/295895-help-little-issue/
Share on other sites

  • Solution

Code for config.php looks ok to me. However you should add error checking to your code to know why the database connection is failing.

<?php
@session_start();
$connectdb=mysql_connect("localhost","7milimetros","Chetan123") or trigger_error('Unable to connect to mysql: ' . mysql_error(), E_USER_WARNING);
$usedb=mysql_select_db("7milimetros",$connectdb) or trigger_error('Unable to select databae: ' . mysql_error(), E_USER_WARNING);
$_SESSION['token']=session_id();
?> 

This will either force an error message to be shown or it will be logged in your servers error logs.

Link to comment
https://forums.phpfreaks.com/topic/295895-help-little-issue/#findComment-1510071
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.