# Mysql errors...no idea what's wrong

**URL:** <https://forum.kirupa.com/t/mysql-errors-no-idea-whats-wrong/240461>\
**Category:** Uncategorized\
**Created:** [October 3, 2007, 6:46am UTC](https://forum.kirupa.com/t/mysql-errors-no-idea-whats-wrong/240461 "2007-10-03T06:46:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tophy](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@Tophy](https://forum.kirupa.com/u/Tophy)\
**Post date:** [October 3, 2007, 6:46am UTC](https://forum.kirupa.com/t/mysql-errors-no-idea-whats-wrong/240461/1 "2007-10-03T06:46:50Z")

</div>

Wow. I haven’t been on this board in years. I forgot my username and password. How sad. LOL. Okay…so here’s my dilemma. It’s been a long time since I’ve done mysql functions in php, and I came up with the code below. I keep getting a mysql\_query() is not a valid mysql-link resource error. I’ve looked at this…even recoded it…played with quotations (I’ve seen them be an issue on some servers…no idea why)…all until I’m about blue in the face. I need some fresh eyes. I’ve spent too long with this. LOL. Is there something I’ve overlooked?

```auto
<?php

$dbuser = "<blanked out for security reasons>";
$dbpass = "<blanked out for security reasons>";
$hostname = "<blanked out for security reasons>";
$database = "tophywww";
$dbinterface = mysql_connect($hostname,$dbuser,$dbpass) or die("Could not connect." . mysql_error());
$db = mysql_select_db($database,$dbinterface) or die("Could not execute." . mysql_error());
$table = "news";

$newsq = "select * from $table order by date desc ";
$start = "0";
$rownum = "3"; //Number of entries to display
$newsq .= "limit $start,$rownum";
$result = mysql_query($newsq,$db) or die("Could not execute : $newsq." . mysql_error());

while ($news = mysql_fetch_array($result))
{
$title = $news["title"];
$date = $news["date"];
$user = $news["username"];
$text = $news["text"];
}

?>

```
