php mysql query question. - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-12-2010, 03:32 PM   #1 (permalink)
Junior Member
 
Join Date: Feb 2010
Posts: 2
Default php mysql query question.

How would I go about using php to query a database row, in a table.

For instance, I have a dynamic page setup now, lets say this one page has 20 different articles, and when you select an article from the left hand side, the article appears on the page (loads from the database).

So if you choose article A, article A's content appears on the page.
You choose article B, article B's content appears on the page

..so on and so forth.

Back to the question, how would I set this up in php so when article A is chosen, it selects article A's metadata (title, page desc, keywords) information, same with article B, C, etc? I already have a table set to go, just need a little help creating the code?

Thanks!
thegrandwazoo is offline   Reply With Quote
Sponsored Links
Old 02-14-2010, 03:47 PM   #2 (permalink)
swg
Junior Member
 
Join Date: Feb 2010
Posts: 23
Default Re: php mysql query question.

Connect to the MySQL server using mysql_connect

Select the correct database with mysql_select_db

execute the query using mysql_query, something like SELECT * FROM `artiles` WHERE `id` = '$id' - be sure to escape/clean any inputs

Then use mysql_fetch_object to load the data into an object so you can use $obj->column_name
swg is offline   Reply With Quote
Old 02-16-2010, 05:20 PM   #3 (permalink)
Junior Member
 
Join Date: Feb 2010
Posts: 2
Default Re: php mysql query question.

Yes I have gotten that far, what I am stuck on is how do I tell PHP to query a specific row from the table?
thegrandwazoo is offline   Reply With Quote
Old 02-20-2010, 01:43 PM   #4 (permalink)
Member
 
Join Date: Nov 2009
Posts: 101
Default Re: php mysql query question.

thanks swg, really gr8
masud7827 is offline   Reply With Quote
Old 03-28-2010, 05:19 PM   #5 (permalink)
Member
 
novintabligh's Avatar
 
Join Date: Mar 2010
Posts: 106
Send a message via Yahoo to novintabligh
Default Re: php mysql query question.

you should select the specific row by "where" in query
novintabligh is offline   Reply With Quote
Old 03-28-2010, 11:17 PM   #6 (permalink)
Junior Member
 
Join Date: Jan 2010
Posts: 73
Default Re: php mysql query question.

You can choose the CMS is pretty nice and simple operation
Foresee2010 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 12:49 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting