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
https://forums.phpfreaks.com/topic/80666-solved-mysql-error-php-error/
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");

 

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'];
}

 

i found the problem,

there was a white space in from of the table name it was hard to see, but i looked at it care fully and i saw the white space.

so if any one is having a problem wher eyou have the table but can't selected watch out for any white space in the name.

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.