Jump to content


Photo

SELECT DB


  • Please log in to reply
4 replies to this topic

#1 Arsench

Arsench
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 20 September 2006 - 12:17 PM

HELLO ALL

PLEASE WHO CAN HELP ME TO DISPLAY DATA ON THE WEB PAGE.HERE IS CODE BUT IT DOESNT WORK.
THANK YOU ALL

<?php

$username="5543";
$password="123456";
$database="5543";


mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$sql = mysql_query("SELECT * FROM links" ,$db);


$result=mysql_query($sql);


echo ("<table border ='1'>");

  echo ("<tr><td>Category</td><td>E-mail</td><td>URL</td><td>Description</td></tr>");

  while ($tablerows = mysql_fetch_row($sql))
  {

  echo("<tr><td><a href='$tablerows[0]'>$tablerows[1]</a></td><td>$tablerows[2]</td><td>$tablerows[3]</td><td>$tablerows[4]</td></tr> ");
  }
  echo "</table>";

  mysql_close($db);
  ?>


#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 20 September 2006 - 12:31 PM

You need to remove the $db from the end of your query...

Like this.
$sql = mysql_query("SELECT * FROM links") or die(mysql_error());

Also, you might want to through in a
or die(mysql_error());
like shown above. This will allow you to see any sql errors that you may have.

Hope this helps,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 Arsench

Arsench
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 20 September 2006 - 12:44 PM

You need to remove the $db from the end of your query...

Like this.

$sql = mysql_query("SELECT * FROM links") or die(mysql_error());

Also, you might want to through in a
or die(mysql_error());
like shown above. This will allow you to see any sql errors that you may have.

Hope this helps,
Tom


thank you friend but can see the results .you can see here the sait

http://khaarsen.ueuo...o.com/list.php  its gives a blank page always

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 20 September 2006 - 01:39 PM

It doesn't look blank to me.

Info: PHP Manual


#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 20 September 2006 - 01:44 PM

Can you post that whole page that is displaying in the link please cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users