Click here to Skip to main content
15,896,359 members
Home / Discussions / Database
   

Database

 
AnswerRe: Connecting DB tables Pin
Member 153296131-Nov-21 3:53
Member 153296131-Nov-21 3:53 
GeneralRe: Connecting DB tables Pin
MekaC1-Nov-21 16:00
MekaC1-Nov-21 16:00 
GeneralRe: Connecting DB tables Pin
Member 153296132-Nov-21 1:09
Member 153296132-Nov-21 1:09 
GeneralRe: Connecting DB tables Pin
MekaC1-Nov-21 15:59
MekaC1-Nov-21 15:59 
GeneralRe: Connecting DB tables Pin
Richard MacCutchan1-Nov-21 22:46
mveRichard MacCutchan1-Nov-21 22:46 
SuggestionRe: Connecting DB tables Pin
CHill602-Nov-21 0:05
mveCHill602-Nov-21 0:05 
AnswerRe: Connecting DB tables Pin
Eddy Vluggen12-Nov-21 12:02
professionalEddy Vluggen12-Nov-21 12:02 
QuestionHow much difference is there between SQL server 2008 and 2012 Pin
jkirkerx28-Oct-21 9:09
professionaljkirkerx28-Oct-21 9:09 
AnswerRe: How much difference is there between SQL server 2008 and 2012 Pin
phil.o28-Oct-21 9:35
professionalphil.o28-Oct-21 9:35 
GeneralRe: How much difference is there between SQL server 2008 and 2012 Pin
jkirkerx28-Oct-21 9:43
professionaljkirkerx28-Oct-21 9:43 
GeneralRe: How much difference is there between SQL server 2008 and 2012 Pin
phil.o28-Oct-21 9:58
professionalphil.o28-Oct-21 9:58 
GeneralRe: How much difference is there between SQL server 2008 and 2012 Pin
jkirkerx28-Oct-21 10:09
professionaljkirkerx28-Oct-21 10:09 
QuestionRe: How much difference is there between SQL server 2008 and 2012 Pin
CHill602-Nov-21 0:10
mveCHill602-Nov-21 0:10 
AnswerRe: How much difference is there between SQL server 2008 and 2012 Pin
jkirkerx2-Nov-21 7:45
professionaljkirkerx2-Nov-21 7:45 
QuestionArray Issue Pin
MekaC24-Oct-21 17:59
MekaC24-Oct-21 17:59 
AnswerRe: Array Issue Pin
Richard Deeming24-Oct-21 22:05
mveRichard Deeming24-Oct-21 22:05 
GeneralRe: Array Issue Pin
MekaC25-Oct-21 11:13
MekaC25-Oct-21 11:13 
AnswerRe: Array Issue Pin
Richard MacCutchan24-Oct-21 22:07
mveRichard MacCutchan24-Oct-21 22:07 
GeneralRe: Array Issue Pin
MekaC25-Oct-21 11:14
MekaC25-Oct-21 11:14 
AnswerRe: Array Issue Pin
jkirkerx28-Oct-21 9:04
professionaljkirkerx28-Oct-21 9:04 
Your pretty far off with your code, and I'm not sure which version of PHP your using. Plus your code is very primitive and not object oriented like for PHP versions 7 and up. You have to create a db connector as a class and call that db connector. Then create a query. Next run that query with the db connector which creates a result. The result can be false if nothing comes back, or can be a array of records in which you fetch them. Finally you call that array that was returned and convert them to rows.

I packed the rows into an object that I created, and return the object instead of an array. The code your writing is very the year 2000, and is quite old and outdated. Nobody in western democracies are writing code like that anymore.

PHP 7.4 example, what you should be learning.
Hope that helps you, and PHP Storm by Jet Brains is the preferred editor or IDE for PHP.
<br />
public static function getUsers(): Users {

        $users = new Users();

        $query = "
        SELECT 
               uid, 
               Username<br />
        FROM [user]
        WHERE User_type <> 'xxxxxxx' 
        ORDER BY Username";

        $conn = DbConnectRepository::createConn();
        $result = sqlsrv_query($conn, $query) or die(" getUsers " . LINE . " - " . $query . ' - ' . print_r(sqlsrv_errors()));
        while ($row = sqlsrv_fetch_array($result)) {

            $user = new User();
            $user->setUserId($row[0]);
            $user->setUserName($row[1]);<br />
            $users->add($user);

        }

        return $users;

    }
If it ain't broke don't fix it
Discover my world at jkirkerx.com

QuestionLooking for feedback and contributions to database project Pin Pin
Michael Sydney Balloni17-Oct-21 13:06
professionalMichael Sydney Balloni17-Oct-21 13:06 
QuestionHow to write stored procedure in mysql workbench. SELECT, INSERT, UPDATE,DELETE Pin
Member 1539388914-Oct-21 0:05
Member 1539388914-Oct-21 0:05 
AnswerRe: How to write stored procedure in mysql workbench. SELECT, INSERT, UPDATE,DELETE Pin
Richard MacCutchan14-Oct-21 0:33
mveRichard MacCutchan14-Oct-21 0:33 
AnswerRe: How to write stored procedure in mysql workbench. SELECT, INSERT, UPDATE,DELETE Pin
CHill6022-Oct-21 0:08
mveCHill6022-Oct-21 0:08 
Questionremove Pin
Member 1489067811-Oct-21 20:23
Member 1489067811-Oct-21 20:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.