Jump to content

[SOLVED] mysql error? php error?


corillo181

Recommended Posts

i have this code


<?php

function  get_tn($id){
$query = "SELECT thumb_path FROM tra_artist_photo WHERE artist_id='$id'";
$result =$this->db->query($query);
$tn_path = $this->db->fetch_array($result);
return $tn_path['thumb_path'];
}

?>
the result of this is this 
[b]Query Error: Table 'travesurahouse_com.tra_artist_photo' doesn't exist[/b]

this result is wrong because i do got the table in mysql ..
[code]
`tra_artist_photo` (
  `photo_id` int(10) unsigned NOT NULL auto_increment,
  `artist_id` int(10) unsigned NOT NULL,
  `thumb_path` varchar(40) NOT NULL,
  `image_path` varchar(40) NOT NULL,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`photo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

 

[/code]

Link to comment
Share on other sites

Please show code on where you select your DB.  For example...

 

//this connects to the server using the user name and password

$db = mysql_connect("localhost","username","password")

or die("Could not connect!");

 

//this then selects the database

mysql_select_db($db = "database_name")

or die ("Could not select database");

 

Link to comment
Share on other sites

Do you have phpMyAdmin? If so, run this code. Take the screen output and copy it. Go to phpMyAdmin, load the database, and select the SQL tab from the main window. Paste in the copied text, select GO and let us know what phpMyAdmin says... paste the screen output here too.

 

PhREEEk

 

<?php
function  get_tn($id){
    $query = "SELECT thumb_path FROM tra_artist_photo WHERE artist_id='$id'";
    die("$query");
    $result =$this->db->query($query);
    $tn_path = $this->db->fetch_array($result);
    return $tn_path['thumb_path'];
}

 

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.