MySQL Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

ok i ran the query in phpmyadmin and this is wut i got

Code: Select all

Error

SQL-query :  

SELECT * 
FROM stats
LIMIT 0 , 30 

MySQL said: 


#1146 - Table 'krunk_gtstat.stats' doesn't exist
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

In phpmyadmin, what does 'SHOW TABLES' output ?
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

wut do u mean?

SHOW TABLES?
coreycollins
Forum Commoner
Posts: 67
Joined: Sun Feb 01, 2004 1:04 pm
Location: Michigan

Post by coreycollins »

In the Query window Type SHOW TABLES just like you did the SELECT statement.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

hi again bawla :D

I think you have the issue confused. database and what is a table (i'm basing this on our talk from last night)

A database is a structure that will hold your tables.
your tables are the rows within (remember, username and percent)

in phpmyadmin, on the left menu theres a, in your case, krunk_something
this is your database, below that theres a list of tables inside that database.

are u sure your matching everything correctly? SHOW tables you will have to insert taht into the window (if you click on the sql link, u can insert it there)
Last edited by tim on Sat Mar 20, 2004 4:03 pm, edited 1 time in total.
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

Last edited by bawla on Sat Mar 20, 2004 4:04 pm, edited 1 time in total.
coreycollins
Forum Commoner
Posts: 67
Joined: Sun Feb 01, 2004 1:04 pm
Location: Michigan

Post by coreycollins »

The link doesn't work.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

i get a 404 with that link.
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

coreycollins
Forum Commoner
Posts: 67
Joined: Sun Feb 01, 2004 1:04 pm
Location: Michigan

Post by coreycollins »

I just poked around your directory listing. The table name is stat according to the SHOW TABLES not stats. If you correct that it should work.
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

Code: Select all

Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3 in /home/krunk/public_html/gtthing/gtthing3.php on line 25
Username: 

Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3 in /home/krunk/public_html/gtthing/gtthing3.php on line 29
Percentage:
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

i guess, that that means theres nothing in the rows
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

What does the below output?

Code: Select all

<?php
$db = mysql_connect('localhost', 'database', 'password') or die(mysql_error());
mysql_select_db('database') or die(mysql_error());
$sql = "SELECT * FROM stat";
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result)){
  $row = mysql_fetch_assoc($result);
  echo 'Username: '.$row['username']."<br>\n";
  echo 'Percentage: '.$row['percent']."<br>\n";
} else {
   echo 'No rows found';
}
?>
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

no rows found
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Then, without sounding too obvious, there are no rows in the table, put some in :)
Post Reply