This is a discussion on mysql query W php within the MySQL Database forums, part of the Database Forums category; I'm try to connect to a database: the connection works but i don;t get a anything form it, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm try to connect to a database: the connection works but i don;t get
a anything form it, where is the error? <?php @ $db=mysql_pconnect('localhost', 'database_name', 'password'); if (!$db) { echo 'conneciton error'; exit; } else { echo 'connection on!'; } mysql_select_db('books'); //books: a database that i previously created. $query="select * from orders"; //orders: a table that i have previosly created. $result=mysql_query($query); $num_results=mysql_num_rows($result); if ($num_results = 0) { echo'<br><br>nothing to dispaly'; } else { echo'<br><br>here are the results: $num_results'; } ?> |
|
|||
|
vinnie wrote:
> I'm try to connect to a database: the connection works but i don;t get > a anything form it, where is the error? > > <?php > @ $db=mysql_pconnect('localhost', 'database_name', 'password'); > if (!$db) > { > echo 'conneciton error'; > exit; > } > else > { > echo 'connection on!'; > } > mysql_select_db('books'); //books: a database that i > previously created. > $query="select * from orders"; //orders: a table that i have > previosly created. > $result=mysql_query($query); > $num_results=mysql_num_rows($result); > if ($num_results = 0) > { > echo'<br><br>nothing to dispaly'; > } > else > { > echo'<br><br>here are the results: $num_results'; > } > ?> > if ($num_results == 0) Norm |