118 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for seularts

I have 2 files: apix.php and crud.php. I am trying to convert the fetched data from php to a jason print. The issue is that the function does not the results for me to parse in the next section of my code. The CRUD.php: class crud { private $db; function …

Member Avatar for seularts
0
450
Member Avatar for Violet_82

Hi guys, I wonder if you can help. As I've started as a programmer, I've been told I have to practice OO a bit more. I've done the theory, but I think I will have to take another look at it. , Above all though, I have to do exercises. …

Member Avatar for AssertNull
1
582
Member Avatar for Sphinx'LostNose

Normally you can do this and pass the reference type by reference and the new keyword won't make the variables point to different objects: static void Main(string[] args) { Object origObj = new Object(); ExampleMethod(ref origObj); } void ExampleMethod(ref Object newObj) { //origObj will also reference the newly created object …

Member Avatar for ddanbe
0
235
Member Avatar for loldafuq

Here is what i have to do Create Class CSalary with private member variables string m_strProfession double m_dSalary Constructors:Default,Copy,Explicit Functions: 1/string GetProf(void),double GetSalary(void) 2/SetProf(const string val),SetSalary(const double val) 3/Output(ostream&) and Input(istram&) 4/Operators:<<,>>,=,==,<,double operator*(const CSalary&obj) Create Class CCalcCorr with private member variables: vector<CSalary>m_vCity1//data for city 1 vector<CSalary>m_vCity2//data for city 2 double …

Member Avatar for tinstaafl
0
353
Member Avatar for toxicandy

First off, here is the code I will be referencing: package com.airamerica.dataConversion; import com.airamerica.Airports; import com.airamerica.Person; import com.airamerica.Products.Products; import com.airamerica.Products.Tickets; public class FindObject { public static Airports findAirport(String airportCode, Airports [] airportsArray){ Airports airport = null; for(int j = 0; j < airportsArray.length; j++) { if (airportCode.equals(airportsArray[j].getCode())){ airport = airportsArray[j]; …

Member Avatar for overwraith
0
286
Member Avatar for rpv_sen

Hi I am trying to create a update function. But it not updating in the database. Please help me to fix. **Test-2.php** $whereString = ''; $bind = NULL; if(isset($_POST['Submit'])) { if($_POST) { $SCYQ64UKID = $_GET['SCYQ64UKID']; $SCYQ64AVGP = $_POST['SCYQ64AVGP']*100; $searchFields = array('SCYQ64EMAL'=>$_POST['SCYQ64EMAL'],'SCYQ64EV01'=>$_POST['SCYQ64EV01'],'SCYQ64EV02'=>$_POST['SCYQ64EV02'],'SCYQ64EV03'=>$_POST['SCYQ64EV03'],'SCYQ64EV04'=>$_POST['SCYQ64EV04'],'SCYQ64EV05'=>$_POST['SCYQ64EV05'],'SCYQ64EV06'=>$_POST['SCYQ64EV06'],'SCUSER'=>$_POST['SCUSER'],'SCYQ64AVGP'=>$SCYQ64AVGP,'SCYQ64TZ'=>$_POST['SCYQ64TZ'],'SCJOBN'=>gethostname(),'SCPID'=>'SSWEB','SCUPMJ'=>$_POST['SCUPMJ'],'SCUPMT'=>$_POST['SCUPMT']); if($post = array_filter($_POST)) { if($fields = array_intersect_key($searchFields, $post)) { …

Member Avatar for rpv_sen
0
449
Member Avatar for rpv_sen

Hi I am trying to display count of a row using function with get values. Please help me to fix the issue **class** class Users { private $conn; private $db_name= "DATABASE"; public function __construct($db) { $this->conn = $db; } /*Join Two Tables with where condition and order by*/ public function …

Member Avatar for rpv_sen
0
575
Member Avatar for rpv_sen

I have created a function. if i provide correct username and password. i am getting a error message as **Sorry, that username / password is invalid !** can any one please help me to fix the issue. **login.php** <?php require 'include/init.php'; $general->logged_in_protect(); if(empty($_POST) === false) { $username = trim($_POST['username']); $password …

Member Avatar for rpv_sen
0
573
Member Avatar for rpv_sen

Hi I am trying to connection my database ODBC using function. I am getting an error **Connection error: could not find driver** **mycode is** <?php class Database{ // specify your own database credentials private $host = "servername"; private $db_name = "databsename.schemaname"; private $username = "username"; private $password = "password"; public …

Member Avatar for rpv_sen
0
3K
Member Avatar for m-soft

Hi, Reading CodeIgnitier documentation I saw some statements having this form: $this->someword->somefunction(); and I don't know what is that. Is someword an multi-dimensional/associative array? I know that if I create an instance of a class I can access its properties and functions with a single -> operator or with :: …

Member Avatar for pritaeas
0
148
Member Avatar for jay.barnes

Hi all, I've been working with PHP, using procedural methods, for several years now, and have begun to explore the object-oriented side of it. While it didn't take me long to understand the potential advantages that come with working in this manner, I'm still having some trouble wrapping my head …

Member Avatar for jay.barnes
0
416
Member Avatar for G_S

Hello everyone. I am currently making some database connection modules in Python inb order to learn Python's approach to OOP and also to lear how to connect to databases via Python. I successfully made a package with modules for postgres, mysql, sqlite3, and MongoDB. The classes simply connect, disconnect and …

Member Avatar for Gribouillis
0
514
Member Avatar for SkateX

Greetings, I'm having problems with my output. Essentially I am just trying to print out any Cat who is over 3 years old and has Claws. But my output keeps printing out either nothing at all or the 3rd cat 3 times. I've struggled with this for hours trying to …

Member Avatar for JamesCherrill
0
296
Member Avatar for samson.dadson.3_1

the problem I have here is: when I input an integer it works fine, but when i input any other thing, it doesn't give me a chance to input again when the loop iterates, it just keeps printing "error type the right thing" to the screen even though "cin var" …

Member Avatar for samson.dadson.3_1
0
2K
Member Avatar for kxjakkk

I'm trying to write a boolean function that takes two Mytime objects, t1 and t2 as arguments, and returns True if the object falls inbetween the two times. This is a question from the How to Think Like a Computer Scientist book, and I need help. What I've gotten so …

Member Avatar for David W
0
440
Member Avatar for Builder_1

please tell me in how many ways OBJECT ORIENTED PROGRAMMING is different from procedural programming in JAVA

Member Avatar for JamesCherrill
0
292
Member Avatar for raminshahab

I can't seem to get a response from my query method. I have a database connection from method ping_server and use mysqli as connector. Can anyone help me figure out why I cannot print results from mysqli_fetch_array. dbclass.php class db { private $connection; private $selectdb; private $lastQuery; private $config; function …

Member Avatar for raminshahab
0
345
Member Avatar for tunisia

I'm trying to modify this code to take advantage of classes and some other oop features. However, I'm struggling with getting beyond the basics. This is the code that I started with which I am trying to change and make more class absed. import glob import os import sys print(os.getcwd()) …

0
199
Member Avatar for BenWard

Hi, I've got a class in PHP with an array of objects in it. I need to loop through these objects and call 2 methods on them but I'm not sure of the best approach. When dealing with arrays, if you use foreach, you can't seem to update the actual …

Member Avatar for BenWard
0
232
Member Avatar for Qazi_1

Hi guys, Tomorrow is my theory paper exam of C++ OOP and Data Strucutre. Paper will be based on 50% theory Q/A and 50% on coding implentaion. Can you give me some hints to prepare for this coming exam? PS. I have gone throw all lectures slides and course material, …

Member Avatar for mathijs
0
253
Member Avatar for annyangel

hlo all, i need to write a code in php oop for registration without using form and data directly goes in the database. i try to write the code for this. i show u that code and help me to correct that or by giving me another code. the database …

Member Avatar for annyangel
0
237
Member Avatar for Gaetane

This started out as `I love PHP traits! I'm going to use them everywhere! ^_^` and now it has turned into a `Thought Exercise / Learning Experience >_<`. Consider the following example: trait TheErrorOfYourWays{ public function booboo(){ echo 'You had a booboo :('; } } trait SpectacularStuff1 { use TheErrorOfYourWays; …

Member Avatar for Gaetane
2
2K
Member Avatar for diafol

Having just found 'traits' - see http://www.daniweb.com/web-development/php/threads/468928/php-trait-method-conflicts-trait-inheritance#post2043565 I was wondering whether they could be used to share a DB connection object across disparate classes, or would the old singleton or dependency injection methods still be the way to go? I'd value any views on this.

Member Avatar for diafol
2
713
Member Avatar for davidjennings

Hi All, I am trying to add insert/update and delete to an OOP singleton database connection using public functions like this, not sure if it is correct? example code public function insert($sql){ if($this->_execute= $this->_mysqli->_execute($sql)){ while ($row = $this->_execute->fetch_object()){ $this->_results[] = $row; } $this->_count = $this->_execute->num_rows; } return $this; } //page …

Member Avatar for diafol
0
241
Member Avatar for davidjennings

Hi All, I am trying to connect to a database OOP singleton method. I am getting an error "syntax error, unexpected 'function_construct'" and I unable to find the syntax error in the code. Any help with this would be appreciated. Thanks in advance David // Page: index.php <?php require_once 'classes/db.php'; …

Member Avatar for davidjennings
0
820
Member Avatar for pro_student

please can you help me to solve this problem :>>> no develop a bookstore information system. The bookstore manages a collection of books it is selling, book orders, and customers who purchased from the store. A book store also has a counter that accepts cash from book sales. Each book …

Member Avatar for pro_student
0
281
Member Avatar for Clanstrom

I'm having hard times, learning desing patterns. And, I've been reading quite a lot. But, I'm only interested to know, about two things: Adapter & Factory patterns. From what I undestood, (*which is close to nothing*) Factory Pattern helps create objects on the fly Adapter Pattern helps adapt your class …

Member Avatar for pritaeas
0
211
Member Avatar for dany12

I would like some help with my connect class.This class is created by me it is my way of thinking so i would like to know why this class dossent get my variables and connect proprely to mysql. the code <?php /** * Exp:Connect to database in oop style @params …

Member Avatar for pritaeas
0
1K
Member Avatar for dany12

Hy I want to understand what is a better approach on problem solving point of view for a php project , a framework or the mvc pattern? I would like to add that I know that both principels are quite the same but with a minor diffrence that a framework …

Member Avatar for dany12
0
368
Member Avatar for Clanstrom

I would like to know, why extending a built-in class in php is important. I mean let's take the PDO class for example. One can either work with using new PDO(); or class Foo extends PDO. to do the same task. I guess, maybe the only thing that makes sense …

Member Avatar for diafol
0
441

The End.