Cannibal_Monkey Posted January 27, 2007 Share Posted January 27, 2007 Okay I want to retrieve data from Database OPO and from Table B. How do I do that exactly? This is the code we have.[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><?php$connection=mysql_connect("localhost","root","")or die ("message");$db=mysql_select_db("opo",$connection)or die ("message2");$a = "SELECT * FROM b"?><body></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/35996-retriving-data-from-table/ Share on other sites More sharing options...
pocobueno1388 Posted January 27, 2007 Share Posted January 27, 2007 [code]<?php$connection=mysql_connect("localhost","root","")or die ("message");$db=mysql_select_db("opo",$connection)or die ("message2");$a = "SELECT * FROM b WHERE condition" // you need to put a condition$result = mysql_query($a);$row = mysql_fetch_assoc($result);//start printing thingsecho "{$row['whatever']}";?>[/code] Link to comment https://forums.phpfreaks.com/topic/35996-retriving-data-from-table/#findComment-170753 Share on other sites More sharing options...
shocker-z Posted January 27, 2007 Share Posted January 27, 2007 [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><?php$connection=mysql_connect("localhost","root","")or die ("message");$db=mysql_select_db("opo",$connection)or die ("message2");$a = "SELECT * FROM b"$query=mysql_query($a);while ($row=mysql_fetch_array($query)) {echo "$row['field1'] - $row['field2'] - $row['field3']"}?><body></body></html>[/code]hope that is of help to you RegardsLiam Link to comment https://forums.phpfreaks.com/topic/35996-retriving-data-from-table/#findComment-170755 Share on other sites More sharing options...
nloding Posted January 27, 2007 Share Posted January 27, 2007 Both of those replies and the original code are missing a very crucial ; after the $a query. Make sure you don't miss that. Link to comment https://forums.phpfreaks.com/topic/35996-retriving-data-from-table/#findComment-170756 Share on other sites More sharing options...
shocker-z Posted January 27, 2007 Share Posted January 27, 2007 would we miss somthing as simple as that!!? ;)Cannibal_Monkey: remember that extra ; as nloding said :)Liam Link to comment https://forums.phpfreaks.com/topic/35996-retriving-data-from-table/#findComment-170760 Share on other sites More sharing options...
nloding Posted January 27, 2007 Share Posted January 27, 2007 Hey, I feel helpful now! First time I've been able to answer a question, rather than just ask one! Maybe I'm getting better ...... nah, can't let my ego get to me :) Link to comment https://forums.phpfreaks.com/topic/35996-retriving-data-from-table/#findComment-170765 Share on other sites More sharing options...
Cannibal_Monkey Posted January 28, 2007 Author Share Posted January 28, 2007 Thanks guys :) Link to comment https://forums.phpfreaks.com/topic/35996-retriving-data-from-table/#findComment-170813 Share on other sites More sharing options...
Cannibal_Monkey Posted January 28, 2007 Author Share Posted January 28, 2007 Wait, I'm a little confused. I just want to print the database itself with fields and boxes and stuff. Link to comment https://forums.phpfreaks.com/topic/35996-retriving-data-from-table/#findComment-170816 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.