mysql query W php

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, ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-04-2007
vinnie
 
Posts: n/a
Default mysql query W php

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';
}
?>

Reply With Quote
  #2 (permalink)  
Old 06-07-2007
Norman Peelman
 
Posts: n/a
Default Re: mysql query W php

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
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:36 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0