Jump to content

Archived

This topic is now archived and is closed to further replies.

Arsench

SELECT DB

Recommended Posts

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);
  ?>

Share this post


Link to post
Share on other sites
You need to remove the $db from the end of your query...

Like this.
[code=php:0]
$sql = mysql_query("SELECT * FROM links") or die(mysql_error());
[/code]

Also, you might want to through in a [code=php:0]or die(mysql_error());[/code] like shown above. This will allow you to see any sql errors that you may have.

Hope this helps,
Tom

Share this post


Link to post
Share on other sites
[quote author=tomfmason link=topic=108770.msg437871#msg437871 date=1158755460]
You need to remove the $db from the end of your query...

Like this.
[code=php:0]
$sql = mysql_query("SELECT * FROM links") or die(mysql_error());
[/code]

Also, you might want to through in a [code=php:0]or die(mysql_error());[/code] like shown above. This will allow you to see any sql errors that you may have.

Hope this helps,
Tom

[/quote]

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

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.