Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Can you see anything wrong with this??
Old 11-10-2007, 04:18 PM Can you see anything wrong with this??
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
PHP Code:
<?php
        
//info list
        
include "../conn.php";
        
$id=$_GET['id'];
        echo 
'id is '.$id.'<br />';
        
$sql=mysql_query("SELECT * FROM work WHERE id='$id'");
        if(!
$sql)
            { echo 
mysql_error(); }
        echo 
'<li>'.mysql_result($sql1).'<li>';
        
?>
I keep getting the following result

Quote:
id is 1

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 1 on MySQL result index 7 in /home/inspin/public_html/work/details.php on line 13
I dont know why, because id comes up as 1, and there is a row in the work table which has an id of 1!
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 11-10-2007, 05:01 PM Re: Can you see anything wrong with this??
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
Any reason your using mysql_result function.

If your resultset is expected to only return one row then the first and only row would be referenced with a 0 (numbering starts at 0). A 1 would be referencing a row that might not exist so the error.

mysql_result($sql, 0)//also needs third parameter(field name) as your selecting *all

You'd be better using one of the mysql_fetch functions. http://uk2.php.net/manual/en/functio...etch-assoc.php
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 11-11-2007, 06:59 AM Re: Can you see anything wrong with this??
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
Ah thanks it's been a while since I've used the mysql_result() function and had forgot how to use it properly!
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Reply     « Reply to Can you see anything wrong with this??
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35121 seconds with 12 queries