Jump to content

Recommended Posts

I am very new to PHP and MySQL. I have a table, users, information such as a primary "id", a "firstname" and "lastname". I also have a table, events, that has three fields: fbla101, php101, and marketing. Each of these is populated with an "id" from the previous table.

 

This is an example of what my events table looks like:

 

fbla101 php101 marketing

4

  4

5   

[/td][td]5

 

I am having trouble displaying the firstname and lastname field for all of the "id"s under fbla101, or any other field in the events table. Any help would really be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/83319-simple-query-two-tables/
Share on other sites

The query does not recognize the column on the events table

 

Table name: events

Column name: fbla101

 

double check to see if the column exists and if it does check to make sure your fbla101 in your query matches the name of the column

 

and

 

you will also want to check and make sure your table name is the same as the table name your using in your mysql query events

I checked and checked again; my table is indeed called "events" and there are three fields that are "fbla101" "php101" and "marketing". All of them throw an error.

 

SELECT users.firstname, users.lastname FROM users WHERE users.id=events.fbla101 OR users.id=events.php101 OR users.id=events.marketing

 

#1054 - Unknown column 'events.fbla101' in 'where clause'

 

I am running this through the SQL tab in phpMyAdmin on my webhost.

I am trying to create a page that will display the names of the users that have signed up for the different events.

 

Example:

 

Users that have signed up for FBLA 101:

John Smith

Jane Doe

Rev Raz

 

Users that have signed up for PHP 101:

Bill Gates

John Doe

Rev Raz

 

etc...

 

Is this a little clearer?

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.