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] Quote Link to comment 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] Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 :) Quote Link to comment Share on other sites More sharing options...
Cannibal_Monkey Posted January 28, 2007 Author Share Posted January 28, 2007 Thanks guys :) Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.