Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-04-2007, 03:35 PM
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';
}
?>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-06-2007, 11:07 PM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:30 PM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.