using php do display database

Posted by bumpn, 10-23-2012, 05:35 PM
i50(dot)tinypic(dot)com/ea332q(dot)jpg now lets say I wanted to display info from column 8, row5 in a div. How would I go about doing that? I know its php but im stuck. I want to create divs I have the connect done, I just need to figure out how to get and and dispaly data from the database Last edited by bumpn; 10-23-2012 at 05:45 PM.

Posted by zoid, 10-23-2012, 05:39 PM
http://lmgtfy.com/?q=select+in+php

Posted by bumpn, 10-23-2012, 05:57 PM
yes that tells me how to pull from a column but not a row. how do you tell the php which row to pull from in that column

Posted by zoid, 10-23-2012, 05:58 PM
where clause in your select statement http://www.w3schools.com/sql/sql_intro.asp

Posted by Herasil, 10-24-2012, 08:50 AM
This page tells you how to query a MySQL database and then display the information in PHP: http://www.w3schools.com/php/php_mysql_select.asp Modify your query as necessary using a WHERE clause to restrict the number of rows.

Posted by KMyers, 10-24-2012, 09:56 AM
It would look something like $query = "SELECT * FROM `table_name` WHERE `row` = '12'"; Of course this would require that you are indexing the rows.

Posted by bumpn, 10-24-2012, 12:19 PM
my data base looks like this its ordered ascending by NO# and col2 is the start of the database NO# is basically invisible and only used as a reference as to row number so lets say I wanted to display on a web page the text in col8, row 5. What would the php code be? Last edited by bumpn; 10-24-2012 at 12:23 PM.

Posted by KMyers, 10-24-2012, 12:21 PM
Then a sample query would look like $query = "SELECT * FROM `table_name` WHERE `NO#` = '5'"; And a simple while loop to set the output to a variable.

Posted by Herasil, 10-24-2012, 12:28 PM
Expanding from KMyers' reply: $query = "SELECT * FROM `table_name` WHERE `NO#` = '5'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $col8 = $row['col8']; The Variable $col8 would then contain "2012".

Posted by zoid, 10-24-2012, 12:45 PM
I posted two links answering exactly these question and other posters mentioned similar urls. It really shouldnt be too difficult now.

Posted by bumpn, 10-24-2012, 05:06 PM
wow so simple

Posted by KMyers, 10-24-2012, 05:09 PM
Yup, you can also do it like.

Was this answer helpful?

 Print this Article

Also Read

How is freestylehosting.com?

Posted by Shazan, 08-30-2002, 06:13 AMHello everyone! I'd like to know if freestylehosting.com...

Question about moving from a MSSQL 2000 to MSSQL 2008 database

Posted by user471, 03-03-2010, 04:47 PMHi, I have a site that stores it's data in a MSSQL 2000...

yaph killed after start

Posted by SysTeam, 09-16-2008, 03:04 PMHi, I have problem. I install Yet Another Proxy Hunter,...

Masking the server's hostname

Posted by billybatson, 09-02-2002, 08:11 PMHi, I'm a reseller about to resell a reseller's...

copy sql?

Posted by Calibaba, 01-11-2008, 05:08 PMQuick question. How do I copy an entire mysql sql...