veedeoo 474 Junior Poster Featured Poster

I second magento. There are others OsCommerce, ZenCart, open cart, Agora cart just to name a few.

Here are some hints on the skill set requirements.
For Magento, you need to have at least basic knowledge of Zend Framework and strong OOP background.

For OsCommerce, ZenCart, Open cart, you need basic understanding of MVC design patterns and strong OOP background. All of these open source cart are pretty good and tested for years. OsCommerce have the most libraries and modules available.

For Agora, OOP background.

Another alternative is to build your own eCommerce system on top of well trusted MVC frameworks like laravel, Kohana, CodeIgniter version 2.2.0, Symfony 2, and Yii. For eCommerce application, I highly recommend Laravel, Kohana and CodeIgniter. The reason is that these frameworks already have a well established payment processing libraries. For example, CI can use omnipay.

By using MVC frameworks as the foundation of your eCommerce project, you are in control of the features you want your application to have. You can always add anything you want at any time. The only downside is that it takes a lot of work before you can see the final product. While in ready made cart, you don't have to do anything, except for features that you want to add. Besides, this can be built to be the ultimate eCommerce CMS if you want.

<M/> commented: Those are some good ones +10
veedeoo 474 Junior Poster Featured Poster

You can use JAVA. Regardless which language you use, they all do some kind of refreshing. If not, how can the application post and recieve messages?

PHP don't need to refresh the entire page for the chat. Ajax can be utilize to do the posting and receiving messages to and from the server.

So, still PHP qualifies for the instant messaging if you are looking for a browser base chat system.

For desktop type application, try JAVA and C++.

veedeoo 474 Junior Poster Featured Poster

You can easily calculate this through the unix timestamp.

for example, to get today at 6AM and tomorrow at 6AM, you would do something like this.

$today = strtotime('today 6am');
$tomorrow =  strtotime('tomorrow 6am');

or

## hours of operation
$open = strtotime('6am');
$close = strtotime('6pm');

based on those sets of information about time, you can easily create what you need to do with the clicked.

another example,

session_start();

if(isset($_POST['login'])){

    $now = time();
    $_SESSION['last_login'] = $now;

}

capturing the last logout

session_start();
if(isset($_POST['logout'])){
    $now = time();
    $_SESSION['last_logout'] = $now ;
}

calculating the elapsed time since last login

$now = time();
$elapsed_time_since = ($now - $_SESSION['last_login']);

calculating total time the user is logged in based on session

$total_time_logged_in = ($_SESSION['last_logout'] - $_SESSION['last_login']);

calculating if the user is entitled to click on the crazy button

if($total_time_logged_in >= $tomorrow){
    $button = true;

    }

    else{

        $button = false;

        }

  echo ($button ? '<input type="submit" name="login" value="login" />' : 'Sorry No button for you little lazy rascal');

I have given you almost 5 possible options. You should be able to solve this problem.

veedeoo 474 Junior Poster Featured Poster

This is a C++ right? If so, can somebody move this to the C++ thread please?

veedeoo 474 Junior Poster Featured Poster

May I see your admin controller? This should be the controller on redirect.

This should be added on the controller accepting the redirect

    $this->session->set_userdata('already_been_here', TRUE);

So that when the user is redirected for the first time, the session already_been_here will be set. When the user is set to go back again to the page where redirection was executed, script will not be redirected for the second time because the user is already been there.

Another concern I have is your statement on your constructor.

function __construct(){
    $this->CI =& get_instance();
    if(!isset($this->CI->session))
    $this->CI->load->library('session');
}

If we look at the statement line by line, it is checking if the session is set. If not, the constructor load the library. There is a problem with that though. How can we check if the session exists if the session library is to be loaded later?

So, I would suggest for you to try checking if the session library is loaded , if not load it and then check if the session exists.

It can be something like this

if (!class_exists('session')){

    $this->CI->load->library('session');
}

In CI, helpers are functions, libraries are classes and therefore session library is a class.

To make sure that it is loading properly, we can test it like this with modified constructor.

public function __construct(){

     if (!class_exists('session')){

    $this->CI->load->library('session');

    }
    ## remove or modify codes below to your requirements after successful testing
    echo (isset($this->CI->session) ? 'session is set': 'no session exists up to this point');

} 
veedeoo 474 Junior Poster Featured Poster

That's pretty easy really. Let say we have class A and class B both with non-static and static methods. We want class B to use some of the class A's methods and class A doing the same for the class B statics both in static and object forms.

example. Here we go .. this is a brain teaser for you and others. Make sure to have some sour gummy bear or lots of soda and coffee. I am not responsible if this will give you a headache.

<?php

     class A
    {

        public function __construct(){}

        public function method_a(){
            echo 'this is non-static method_a from class A <br/>';

           }

        public static function method_b(){
            echo 'this is static method_b from class A <br/>';

        }

        public static function use_class_b(){

            echo B::method_d().'<br/>';
        }

    }

    class B
    {

        public function construct(){}

        public function method_c(){

            $object_a = new A();

            return array(A::method_b(),$object_a->method_a(), $object_a->method_b(), $object_a::method_b());

         }

         public static function method_d(){

             $object_a = new A();
             return $object_a->method_b();

        }

}    

  echo 'Demonstration of class B => static method_d with an object of class A :';
  B::method_d();
  echo '<br/>'; 
  echo 'Demonstration of Class B as object => method_d and method_c : ';

  $object_b = new B();
  $object_b->method_d().' and method_c<br/>'; 

  echo 'This is from method_d with an array output :<br/>';
  $object_b->method_c()[0].' ,'. $object_b->method_c()[1] .','. $object_b->method_c()[2].','.$object_b->method_c()[3].'<br/>';

  echo '<br/>';
  echo 'Demonstration of class A as object<br/>'; 
  echo 'the static mode : ';
  A::method_b();

  echo 'The static use_class_b : ';
  A::use_class_b();
  echo '<br/>';

  echo 'The Object of A <br/>';
  $object_a = new A();
  $object_a->method_a();
  $object_a->method_b();
  $object_a->use_class_b(); …
veedeoo 474 Junior Poster Featured Poster

Pretty much there is not much difference except you cannot use Scope Resolution Operator :: for non-static methods AND static method does not need an instance of the object.

This

className::function()

is use outside the class, while these

self::function()
static::function()

are use within other methods within the class. This

 $this->function();

if use in other static method will throw not in object context error.

Static method is commonly used in Singleton pattern, database connection or anything that don't need to instantiate the entire class. In short static method is independent to the class or object where it belongs.

To prove that static method is not dependent in the class of which it resides, try this..

class Test
{

    public function non_s(){
        echo 'not static method';
        self::static_m(); // this will work
        static::static_x(); //this will work

    }

    public static function static_m(){

        echo 'this is from static method static_m <br/>';
        self::non_s(); // this will throw an error
        $this->non_s(); // this will not work also

       }

     public static function static_x(){
         echo 'This from static_x();
         $this->static_m();// will throw a not in object context error. 
    }

   } 

   ## this will work
   Test::static_m();
   Test::static_x();

   ## this one will not work for the non-static
   Test::non_s(); //will not work

   ## but this will work
   $object = new Test();
   $object->non_s();
   $object::static_x();// this will work
   $object->static_x(); // this will work also

In conclusion, static method can be access regardless if there is an instance of object or not.

veedeoo 474 Junior Poster Featured Poster

as suggested, you can try using VM. There is one called Oracle VM Virtualbox Manager.

You can have many different OS installations as you want. The Iternet connection can be shared with your host computer. Please see attached screenshot

7d763fdfa856f40a2401e36d673f0236

Odesk.com on Unbuntu server skinned with kubuntu.

35fef021f038ec8ae0de9e7e3bb10431

veedeoo 474 Junior Poster Featured Poster

can you try, localhost/laravel/public to see if you can view the welcome page?

for xampp, you need to change this

filename: laravel/app/config/app.php

look for this code

'url' => 'http://localhost/',

change it to

'url' => 'http://localhost/laravel/',

save your changes and direct your browser to

localhost/laravel/public/

you should be able to view the welcome page

veedeoo 474 Junior Poster Featured Poster

Houston, we don't have a problem. Welcome to DaniWeb.

veedeoo 474 Junior Poster Featured Poster

I noticed you have

redirect('admin')

when there is no session admin_id, the user get redirected to the admin controller. on redirect, the hook gets triggered for the second time redirect the user again and the cycle goes on and on and on .

A probable solution is to create another session that can be use to evaluate if this particular user has been or already been redirected to the admin page.

for example, first redirect, the user landed on the admin. We can set a session like this

$this->session->set_userdata('already_been_here', TRUE);

You can then modify this method

function initializeData() {
if(!$this->CI->session->userdata('admin_id')){
redirect('admin');
}

to this method

function initializeData() {
    if(!$this->CI->session->userdata('admin_id') && (!$this->CI->session->userdata('already_been_here'))){

    redirect('admin');

    }
}

Now, what the new method will do is to check for the second condition if the the session already_been_here is NOT TRUE and if it is NOT TRUE, then redirect to the admin controller page.

don't leave this as an empty array

 'params'   => array()

you can either comment it or just replace it with ''.

depending on your CI version, it migh allows you to change this

redirect('admin');

to this

redirect('admin', 'refresh');
veedeoo 474 Junior Poster Featured Poster

can post your router codes for this page? It should be located in app/routes.php.

Can post your controller for this page?
How about the view file?

MVC is easy to figure out. The uri[1] is always the controller or at least a controller has something to do with it. e.g. localhost/installation_dir/controller_name_OR_router_definition/_controller_method/

By the way, how did you install laravel? Did you use composer?

veedeoo 474 Junior Poster Featured Poster

did you try localhost/laravel/hello

The hello should be defined as route.

For example, if we have a controller as shown below. I did not test this, because I don't have any laravel on my development server at the moment.So, most of the codes below are coming out of my head as I type this response. However, your codes should be pretty similar to this.

hello controller

<?php

    class HelloController extends BaseController{

            public function sayHello(){

                $message = 'hello world';
                return View::make('hello', array('message' => $message));

            } 
     }

the above controller can be routed like this

Route::get('hello', 'HelloController@sayHello');

the route above will allow you to access localhost/laravel/hello

there is another way creating a route in Laravel, but I can't remember them right now.

veedeoo 474 Junior Poster Featured Poster

@Cereal

I don't understand why you get a down vote for it though. It must be a C++ pride or something. I will give you an up vote to reflect 0 vote :).

cereal commented: possible, thanks :) +13
veedeoo 474 Junior Poster Featured Poster

is there any chance for you to use JOIN ? Those triple loops are just mind boggling to me.

veedeoo 474 Junior Poster Featured Poster

if you will be adding values for each column, then a second argument to the function must be added and make sure that the count of the values going underneath are perfectly equal to the number of <th> you need to create.

something like this

 create_th($cols_count, $col_header_name){

  if($cols_count > 0 && (is_array($col_header_name) && (count($col_header_name == $cols_count)))){

         return array(true,$col_header_name);
    }
}
veedeoo 474 Junior Poster Featured Poster

You can also try one like this.

First create a function to generate the <th> items. The function can be as simple as this

function create_th($col_header_name){

    if(is_array($col_header_name)){

        return array(true,$col_header_name);
      }

  }

to generate the cols, you call the function like this. There is no limit on how many header cells you can create.

$tbl_cols = create_th(array('Hotel','Class','Single','Adult(RM)','CNB(RM)'));

    if($tbl_cols[0]){


    echo '<table>';
    echo '<tr>';
    foreach($tbl_cols[1] as $th){
        echo '<th>'. $th.'</th>';
    }

    echo '</tr>';
    echo '</table>';

    }

The output should be something like this

<table>
   <tr>
    <th>Hotel</th>
    <th>Class</th>
    <th>Single</th>
    <th>Adult(RM)</th>
    <th>CNB(RM)</th>
   </tr>
</table>

Why use function?
By using function, you can utilize filter_var_array PHP function to filter the items going into the <th>.

that's it..

veedeoo 474 Junior Poster Featured Poster

Hi Emily, welcome to daniweb.

About your services, there is a place in Daniweb called webmaster marketplace.

veedeoo 474 Junior Poster Featured Poster

Just to let you know, I am planning to add a compile function to the Template class later.
Although I am trying to not go very far from PHP doing the template rendering, I want to make sure that the class will be capable of something like this.

business

$fruits = $view->data(array('apple','banana','orange','grapes','pears'));

presentation

<ul>

{foreach $fruits as $item}
    <li>{$item}</li>
{/foreach}

</ul>

Though it may appear to be like smarty, the truth is it is not. I will be using simple PHP function to compile the content of the index.tpl file.

Please stand by for that modification of the class Template.

veedeoo 474 Junior Poster Featured Poster

Georgia, Georgia ♪_♪ . Welcome to Daniweb ☺.

veedeoo 474 Junior Poster Featured Poster

Hey, that's pretty cooool. :).

veedeoo 474 Junior Poster Featured Poster

This tutorial is intended for people who are looking for alternative to PHP template engines like smarty, twig, dwoo, TBS, and others. Not all developers are willing to take the extra efforts needed to learn the template engine syntax. Some are just left behind thinking that PHP is a template engine itself and there is no need for another template engine.

Regardless of what you think about PHP, it has been proven that PHP can be written in procedural, OOP, CLI interface, and spaghetti style .In this particular tutorial, I will be demonstrating how to use PHP effectively as a template engine by way of business logic and presentation logic separation.

What are the requirements?
1. Basic knowledge of OOP ( we are not going to write one, but I will give you one to use. This is for one file only).
2. Xampp or equivalent
3. Basic knowledge with MySQL and PDO.

Objectives
1. The main objective of this tutorial is to minimize the presence of the application's business logic inside the presentation logic.
2. Introduction to PHP magic function called __toString().
3. Avoiding the while loop after the MySQL query, but instead passing the result as an array.
4. Simple exposure to PDO

What is business logic?
Business logic can be the function processing a resulting array from another function, mySQL queries, evaluated results from statments to trigger another function, and all other things that are working behind the background.

iamthwee commented: great +14
veedeoo 474 Junior Poster Featured Poster

Hi and Welcome.

veedeoo 474 Junior Poster Featured Poster

Have you look at DNN (DotNetNuke)

veedeoo 474 Junior Poster Featured Poster

for some reason, you keep on putting back all those codes that i told you to remove.

change this

<html>
<body>
<?php echo ($error ? $error : '' );?>
<form action="index.php" method="post">
<head>
<!-- Basics -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login</title>
<!-- CSS -->
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/styles.css">
</head>
<!-- Main HTML -->
<!-- Begin Page Content -->
<div id="container">
<form>
<label for="name">Username:</label>
<input type="name" name="username" id="username">
<label for="username">Password:</label>
<p><a href="#">Forgot your password?</a>
<input type="password" name="password" id="password">
<div id="lower">
<input type="checkbox"><label class="check" for="checkbox">Keep me logged in</label>
<input type="submit" value="Login" name="login" id="login">
</div>
</form>
</div>
</body>
</form>
</html>

to this

<html>
<head>
<!-- Basics -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login</title>
<!-- CSS -->
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<!-- Main HTML -->
<!-- Begin Page Content -->
<div id="container">
<?php echo ($error ? $error : '' );?>

<form action="index.php" method="post">

<label for="name">Username:</label>
<input type="name" name="username" id="username">
<label for="username">Password:</label>
<p><a href="#">Forgot your password?</a>
<input type="password" name="password" id="password">
<div id="lower">
<input type="checkbox"><label class="check" for="checkbox">Keep me logged in</label>
<input type="submit" value="Login" name="login" id="login">
</div>
</form>
</div>
</body>

</html>
veedeoo 474 Junior Poster Featured Poster

escaping those html tags must hurt your pinky finger :). Years back, there was a great argument on " single quotes vs. double quotes".

so, this one is pretty valid

$form = '<form action="" method="post">';

although this is valid, it keeps your pinky finger busy.

$form = "<form action =\"\" method=\"post\">";

while this one is just the complete opposite of the two. I don't recommend it.

$form = "<form action='' method='post'>";
veedeoo 474 Junior Poster Featured Poster

you can create a new page and call it verified.php and put this code

<?php
    session_start();

if($_SESSION['loggeg_in'] && (isset($_SESSION['username']))){

    echo 'You are logged in as:'. $_SESSION['username'];

    }

Your modified codes should now look like this

<?php

session_start();
$con = mysqli_connect("localhost", "root", "", "numbers") or die(mysqli_error($con));
if(isset($_POST['login'])){

$myusername=mysqli_real_escape_string($con,$_POST['username']);
$mypassword=mysqli_real_escape_string($con,$_POST['password']);

$sql="SELECT username, password FROM admin WHERE username='".$myusername."' AND password='".$mypassword."'";
$check= mysqli_query($con,$sql);
$row = mysqli_fetch_row($check);
if($row[0]!="" && $row[1] !=""){

 ## set logged_in to true
$_SESSION['logged_in']= true;
 ## set username session
$_SESSION['username'] = $row[0]; 

header('location: verified.php');
exit();
}
else
{
$error="Your Login Name or Password is invalid";
//echo "$error";
//echo "<META http-equiv=' refresh' ;URL='index.php'>";
}
}
?>
<html>
<body>
<?php echo ($error ? $error : '' );?>
<form action="index.php" method="post">
<head>
<!-- Basics -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login</title>
<!-- CSS -->
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/styles.css">
</head>
<!-- Main HTML -->
<!-- Begin Page Content -->
<div id="container">
<form>
<label for="name">Username:</label>
<input type="name" name="username" id="username">
<label for="username">Password:</label>
<p><a href="#">Forgot your password?</a>
<input type="password" name="password" id="password">
<div id="lower">
<input type="checkbox"><label class="check" for="checkbox">Keep me logged in</label>
<input type="submit" value="Login" name="login" id="login">
</div>
</form>
</div>
</body>
</form>
</html>

We cannot have any <html> tags before redirect . The only place where you can do it is if you area coding inside the frameworks like CodeIgniter..

veedeoo 474 Junior Poster Featured Poster

try running this

<html>
<body>
<!-- End Page Content -->
<?php
$con = mysqli_connect("localhost", "root", "", "numbers") or die(mysqli_error($con));
if(isset($_POST['login']))
{
//$myusername = $_GET['name'];
//$mypassword = $_GET['password'];
$myusername=mysqli_real_escape_string($con,$_POST['username']);
$mypassword=mysqli_real_escape_string($con,$_POST['password']);
//$sql="SELECT * FROM admin WHERE username='".$myusername."' AND password='".$mypassword."'";
$sql="SELECT username, password FROM admin WHERE username='".$myusername."' AND password='".$mypassword."'";
$check= mysqli_query($con,$sql);
$row = mysqli_fetch_row($check);
if($row[0]!="" && $row[1] !="")
{
//echo "Successful Login";
//echo "<META http-equiv=' refresh' ;URL='form.php'>";
    echo 'you are login<br/>';
}
else
{
 $error="Your Login Name or Password is invalid";
echo "$error";
//echo "<META http-equiv=' refresh' ;URL='index.php'>";
}
}
?>
<form action="deletethis.php" method="post">
<head>
<!-- Basics -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login</title>
<!-- CSS -->
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/styles.css">
</head>
<!-- Main HTML -->
<!-- Begin Page Content -->
<div id="container">
<form>
<label for="name">Username:</label>
<input type="name" name="username" id="username">
<label for="username">Password:</label>
<p><a href="#">Forgot your password?</a>
<input type="password" name="password" id="password">
<div id="lower">
<input type="checkbox"><label class="check" for="checkbox">Keep me logged in</label>
<input type="submit" value="Login" name="login" id="login">
</div>
</form>
</div>
</body>
</form>
</html>

I don't recommend using it in production server, because of the weakness in login validation, but it is sufficient for practice purposes only.

veedeoo 474 Junior Poster Featured Poster

if you var_dump or print_r this

$_FILES['datafile']['type']

what do you get?

Careful with the mime type as Diafol already brough up. A PHP file uploaded will give you "text/plain". By not knowing the exact extension of this file, it means a widely open back door.

ultmt.punisher commented: your suggestion helped. +1
veedeoo 474 Junior Poster Featured Poster

If you want, you can also use this.

veedeoo 474 Junior Poster Featured Poster

can you var_dump or print_r the $userEmail and $hash? What did you get?

veedeoo 474 Junior Poster Featured Poster

Thanks for all of your advice. :). I was depressed all about this for days. The doctor told me he will surgically remove this thing by next week :).

@Dani - Thanks, I bought the rapid relief desitin 2 oz tube pack.
@Slavi - I have been waiting for the eyes for days, but nothing showed up. Thanks :).
@<M/> - Yes, I constantly wash my face more than I should. I am a germophobic with excessive hand washing disorder. Thanks :).

veedeoo 474 Junior Poster Featured Poster

Last week, my Mom told me to clean our garage. When I woke up the following morning, I noticed a big disgusting pimple on my jaw line. As most adults always say, my Mom told to keep my fingers off of it and so I obliged.

At the moment, I am pretty horrified, terrified and petrified by this pimple that won't go away. The problem is that this pimple is now getting pretty big. I mean it is humongous. Nothing have grown on my face like this before. My friends told me to wait for the eye to show up, but there is nothing I could see that look like an eye on it?

I called our family doctor, but they can't take me in until next week. I also purchased some really expensive Retin A as suggested by another friend but to no avail.

can somebody please advice me ... thanks for reading..

veedeoo 474 Junior Poster Featured Poster

Hi and welcome.

veedeoo 474 Junior Poster Featured Poster

Hi Freddyparc, welcome to Daniweb. Cool choice of a new language. Coming from OOP to another OOP should be pretty easy.

veedeoo 474 Junior Poster Featured Poster

Hello and Welcome.

veedeoo 474 Junior Poster Featured Poster

Hi Diyconservatory, welcome to Daniweb.

veedeoo 474 Junior Poster Featured Poster

Hi Yam, welcome to Daniweb.

veedeoo 474 Junior Poster Featured Poster

I think you will get notified for Automatically Watch Articles I Post In? if checked, but I am not sure if when the watch this article button is clicked will trigger the notification.

I hope someone can make clarification on this. :).

veedeoo 474 Junior Poster Featured Poster

Rocky theme song and Thunderstruck by AC/DC should do it for him :).

<M/> commented: or we can play eye of the tiger +0
veedeoo 474 Junior Poster Featured Poster

@iamthwee,

After thinking more about this and the efforts you have already invested on your CMS, would it be possible for you to just build the blog in CI? The reason is that you are almost there. Just few more steps and you're done. You can do it Dude :).

<M/> commented: Lets play the Rocky Theme Song For Him Then +0
veedeoo 474 Junior Poster Featured Poster

Here are the books I currently have on my bookshelf.

  1. Learning Javascript Design Pattern by Addy Osmani published by O'Reilly
  2. Professional Javascript for Web Developers by Nicholas C. Zakas published by Wrox.
  3. Node.js for PHP developers by Daniel Howard published by O'Reilly
<M/> commented: Pretty cool +0
veedeoo 474 Junior Poster Featured Poster

Those links provided by <M/> are pretty good start.

<M/> commented: gracias +10
veedeoo 474 Junior Poster Featured Poster

let's retrace all these..

try this first

<?php

$dsn = 'mysql:host=localhost;dbname=hidden';
$username = 'root';
$password = '';
try {
$dbh = new PDO($dsn, $username, $password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $e->getMessage();
}

if($dbh){

    echo 'connected<br/>';
}

try viewing the page on your borwser and see if it is working. If it is, include this file to this

<?php

    include_once('the_page_above.php');

    function test($dbh){

       echo ($dbh ? 'connection is persistent inside this function' : 'sorry not connected');   
   }

   $x = test($dbh);
veedeoo 474 Junior Poster Featured Poster

@iamthwee,

You are correct. If he is going to distribute this application, no one will be willing to accept a win32 dll file just to run this application. Unless, he can manage to compile the exe just for the PHP. However, executables are not extensions where dll files can be added in the php ext directory. It needs at least 1 for the OS and 1 for the PHP extension for it to work. But then, it looks like he is building something for school or on online classroom. So, he should be able to do it on his own server.

veedeoo 474 Junior Poster Featured Poster

I don't charge people for providing them with the help I could possibly provide. However, you can donate for the cause of Daniweb.

Then you can post the source code here.

veedeoo 474 Junior Poster Featured Poster

try something like this

function getInfo($dbh,$user_row, $mcusername){

if($dbh){

try{

## put your stuffs here
    return $user_row;
}
    catch (PDOException $e) {
        echo $e->getMessage();
    }


}


}

do not wrap the entire function with try because there is no error to catch until the function is called. Besides the error will be occuring inside the function if there is any.

double check your usage of this

$user_row;
veedeoo 474 Junior Poster Featured Poster

The error tells us that the $dbh is a non-object.

Where is the part of the code where it says something like this

   $dbh = new PDO('mysql:host=localhost;dbname=yourdb;charset=utf8', 'username', 'password');
veedeoo 474 Junior Poster Featured Poster

My most preferred in storing images is exactly the same as you have suggested.

Some people prefer to store images in the database. Used to be, images of high value e.g. photographers will store their porfolio in mysql after the copyright has been injected into the image, rather than just creating a layer over them and save in the directory.

Others may have a really good reason in doing so.

veedeoo 474 Junior Poster Featured Poster

it is called BLOb or binary large object. Yes, you can store images as BLOb in the database.

You just have to show us what've got so far. Writing it is pretty easy, but I need see how motivated you are in doing this.