View Single Post
  #1  
Old 08-28-2006, 01:43 PM
cisco cisco is offline
Junior Member
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
cisco is on a distinguished road
Default Mysql_fetch_array issue, parsing most likely the issue

Code:
<?php
function db_connect(){
mysql_connect("localhost","username","pass");
mysql_select_db("database");
}


function get_media_info($category, $id){
db_connect();
$re = mysql_query("SELECT * FROM '$category' WHERE id='$id'");
$r = mysql_fetch_array($re);
$title = $r['title'];
$description = $r['description'];
$file = $r['file'];
$author = $r['author'];
$authorurl = $r['authorurl'];
$rating = $r['rating'];
$tags = $r['tags'];
}

get_media_info('movies', '5');

print $title;
?>

Now a bunch of code has been ommitted in between, but it was simply html stuff for layout purposes.

This script isn't too complex, but I'm returning this error on execution whenever I try to print values such as $title:

Code:
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  Webmaster Forums - View Single Post - Mysql_fetch_array issue, parsing most likely the issue
View Single Post
  #1  
Old 08-28-2006, 01:43 PM
cisco cisco is offline
Junior Member
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
cisco is on a distinguished road
Default Mysql_fetch_array issue, parsing most likely the issue

Code:
<?php
function db_connect(){
mysql_connect("localhost","username","pass");
mysql_select_db("database");
}


function get_media_info($category, $id){
db_connect();
$re = mysql_query("SELECT * FROM '$category' WHERE id='$id'");
$r = mysql_fetch_array($re);
$title = $r['title'];
$description = $r['description'];
$file = $r['file'];
$author = $r['author'];
$authorurl = $r['authorurl'];
$rating = $r['rating'];
$tags = $r['tags'];
}

get_media_info('movies', '5');

print $title;
?>

Now a bunch of code has been ommitted in between, but it was simply html stuff for layout purposes.

This script isn't too complex, but I'm returning this error on execution whenever I try to print values such as $title:

Code:
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote