php/mysql error wont query data properly please help!!?

Jason

New member
Our website has been running smooth for the last 3 months and now it wont work. the error: Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/nations3/public_html/track/overview.php on line 38 (different line numbers for each piece of data it tries to look up)
appears on every page where the page connects to a mysql database. i also cannot enter data into the database via php. any ideas?? thanks alot
 
if you want to enter data into the database, you are going to have to learn SQL. suggest you go to w3schools.com and look at the SQL and PHP courses.
try
mysql_query("INSERT INTO mytable(id,ext,fname) VALUES
(1,'zip','trifex.zip'),
(2,'exe','setup.exe')", $link) or die("oops!:"+mysql_error());

the part with the ID is not usually necesary since those are usually auto_increment anyway, unless you have a setup table you are executing.
note that the SQL statement must *not* end with a semicolon (;). those are not allowed in mysql_query().
 
it is telling you that the data is not there. Example:

You are looking for a guy named Joe in the DB and Joe is not in there. You will have to check for him 1st like this to stop the error.

$user = "Joe";
$query = mysql_query("SELECT * FROM users WHERE User_Name='$user'");
if(mysql_num_rows($query) <= 0)
{
echo "<font color=\"red\">There was an error. No data found for $user</font><br>" . mysql_error();
}
else
{
echo "<font color=\"green\">We found the data for $user</font>";
}
 
Back
Top