php MySQL queryhelp needed from you GODS! :-)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
nexus99
Forum Newbie
Posts: 1
Joined: Tue Oct 15, 2002 8:27 pm

php MySQL queryhelp needed from you GODS! :-)

Post by nexus99 »

Ok, I am writing a block for phpNuke (not that that really matters) but my SQL is returning data not in the tables. First off.. here is the code:

<?

$db_connection = mysql_connect("localhost", "username", "password")
or die("Could not connect to DB");
mysql_select_db ("ratesocal", $db_connection)
or die("Could not find to DB");

$img_query = "SELECT chiff FROM voting ORDER BY media DESC LIMIT 1";
$type_query = "SELECT typ FROM voting ORDER BY media DESC LIMIT 1";

$image = mysql_query ($img_query, $db_connection);

$type = mysql_query ($type_query, $db_connection);


$content = "Test for top picture<br><br> <img src=\"http://nuke.ratesocal.com/modules/vota/ ... mage.$type\">";

?>

Its supposed to return jpg for the $type and 337374747 for the $image but instead it returns

Resource%20id%20#90
and
Resource id #91

If I run the SQL Queries in phpMyAdmin I get the correct results.

Any ideas all?

Jiles
jiles@jiles.org
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Post Reply