Welcome Guest, Not a member yet? Register   Sign In
Getting a blank page
#1

Hi All.

I am a noob at CI, have now worked my way fixing all errors etc, got my "hello world" to work, so th CI is there and working. and off course the index.php file is loading honkey-dori

My problem seems to be DB connection, or I am not sure.....

been testing with the examples from formget.com

insert-data-into-database-using-codeigniter
update-data-in-database-using-codeigniter
delete-data-from-database-using-codeigniter

At first i got some errors, that i fixed, but now when i go to display page (for the above mentioned)
localhost/myDir/index.php/..........

i only get a blank white page, the title is loaded as i can see the text at the top.....  but nothing else
checked and added database to autoload...

i am using CodeIgniter-2.2.0
         PHP 5.63
       MySQL 5  (SQLi)

Any suggestions on how to get it to work........
Reply
#2

If you think you have a Database connection problem you can use this script to test the connection.

PHP Code:
<?php

/**
 * Attempt MySQLi server connection. Assuming you are running MySQL
 * server with default setting (user 'root' with no password)
 *
 * Change root for username and password for your server.
 */
$link mysqli_connect("localhost""root""");
 
// Check connection
if ($link === false)
{
 
   exit("ERROR: Could not connect. " mysqli_connect_error());
}
 
// Print host information
echo "Connect Successfully. Host info: " mysqli_get_host_info($link);

?>

Place in a file and run it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(10-25-2017, 03:16 AM)InsiteFX Wrote: If you think you have a Database connection problem you can use this script to test the connection.

PHP Code:
<?php

/**
 * Attempt MySQLi server connection. Assuming you are running MySQL
 * server with default setting (user 'root' with no password)
 *
 * Change root for username and password for your server.
 */
$link mysqli_connect("localhost""root""");
 
// Check connection
if ($link === false)
{
 
   exit("ERROR: Could not connect. " mysqli_connect_error());
}
 
// Print host information
echo "Connect Successfully. Host info: " mysqli_get_host_info($link);

?>

Place in a file and run it.
Thanks for that!

Connect Successfully. Host info: localhost via TCP/IP

That means my DB connection is working fine.

but i still do not get the test samples from the site - with update , edit or delete in DB to work.

Could it be that they are not working on CI 2.2.0? or something extra needed on that version?

What would be the implications to upgrade to CI 3.X.X ? what are the Pros and Cons?
is it still possible to run that on PHP 5.63? and MySQL 5?

I am sort of lost here
Reply
#4

One always learn new things!

just by chance i did a view source on my white page......

there i see

html>

<head>

<title>Update Data In Database Using CodeIgniter</title>

<link href='http://fonts.googleapis.com/css?family=Marcellus' rel='stylesheet' type='text/css'>

<link rel="stylesheet" type="text/css" href="<br />

<b>Fatal error</b>: Call to undefined function base_url() in <b>C:\My_localhost\application\views\update_view.php</b> on line <b>5</b><br />

Then checking that line in update_view.php

<link rel="stylesheet" type="text/css" href="<?php echo base_url(). "css/update.css" ?>">

After some more research

Just adding url in the config/autoload.php

$autoload['helper'] = array('url');

Then it is working..... Big Grin 

just a little surprise that it would only show in view source......  (one lesson learned)
Reply
#5

Yep, that always gets new users. Another one to remember is that you can always use your
web browsers development tools to find errors F12.

Anyways glad that you found out your problem.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB