Jump to content

SELECT DB


Arsench

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);
  ?>
Link to comment
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
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.