Jump to content

Need PHP/SQL Help Or Ill Fail


27CDruid

Recommended Posts

I desperately need a variety of help with PHP. Currently im trying to pull a list of songs from a database (made in MyPHPAdmin).

 

I have a problem with getting any output whatsoever and any example html/php code of this would be brilliant.

 

So far (it doesnt work at all) i have:

 

<?php

 

  ...

 

  $dbQuery="SELECT SongID, Track, Artist, Album, Downloads FROM song " .

            "    ORDER BY Downloads ASC ";

  $result=mysql_query($dbQuery, $db);

 

  while ($dbRow=mysql_fetch_array($result)) {

 

        $track=$dbRow[“Track”];

 

        echo "Name is $track <br> ";

  }

 

?>

 

<html>

 

<head>

<title>New Releases</title>

    <link rel="stylesheet" href="contactStyles.css">

 

 

</head>

 

<body>

 

      <table class="border" align="left" width="400" cellspacing="0" cellpadding="5" style="height: 266px">

      <tr><th class="style3">The tops tracks are:</th></tr>

 

      <tr><td>

 

        <form action="toptracks.php" method="post">

 

          <table width="100%" cellpadding="3" cellspacing="5" border="0">

 

 

  <tr><td align="center">

                  <font face="verdana" color="navy">

                        "$track"</font><br>

                                </td></tr>

                               

          </table>

 

 

</body>

 

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/134651-need-phpsql-help-or-ill-fail/
Share on other sites

Wrong place, has nothing to do with Math.

And you give up after an Hour?  You know it's the day after Thanksgiving right? 

 

If you get no output with that code, then you have an error.  Display errors and turn error reporting on and post the error.  Unless you're already gone, if so, cya.

change to:

 

$result=mysql_query($dbQuery, $db) or die(mysql_error());

 

 

Though I already suspect that you're using the wrong variable for the 2nd mysql_query argument.  People usually assign mysql_select_db to $db. The 2nd argument to mysql_query (which is optional, btw) should be the connection resource (the variable you assigned mysql_connect to).

Archived

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

×
×
  • 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.