/    Sign up×
Community /Pin to ProfileBookmark

Last row from SQL result Missing.. Help Plz.

Hi,

I have this code:

[CODE]
$SQL = “SELECT `product` FROM products WHERE `title` LIKE ‘%games download%’ OR `description` LIKE ‘%games download%’ LIMIT 1,6”

$result = mysql_query($SQL, $conn);

while( $result2 = mysql_fetch_row($result) ){

$product = $result2[0];
$myLink = myProductLink($product);
echo $myLink.”<br>”;
}
[/CODE]

The problem is that when it get only one(1) row it shows NO results, no echo $myLink. And When more that on result it does not show the LAST Row.. There is ALLWAYS ONE ROW MISSING!!

Could you help me in this!??

Thanks in advance,

nhopping.com

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@nooor83May 14.2006 — i see no problem with your script...

what is that myProductLink($product); function..

where is its code..maybe its causing the problrm..

Noor
Copy linkTweet thisAlerts:
@nhoppingauthorMay 14.2006 — Here is the function:

[CODE]
function myProductLink($product){
$conn= f12ligacao();

$SQL = "SELECT title,description,id FROM products WHERE product = '$product' LIMIT 1";
$result = mysql_query($SQL, $conn);
while( $result2 = mysql_fetch_array($result) ){
$product_title = $result2[0];
$product_description = $result2[1];
$product_id = $result2[2];
}
$myLink = "<a href="?p=".$product_id."" onMouseOver="(window.status=''); return true" target="_blank">".$product_title."</a><br>".$product_description."<br>";
return $myLink;
mysql_close();
}
[/CODE]


Can you help me in this?

I allways miss the last Link.. and when its only one I get NONE!! :/

Thanks in advance,

nhopping.com
Copy linkTweet thisAlerts:
@NogDogMay 14.2006 — My guess is that you want to use [b]LIMIT 0, 6[/b], since the first record of any result set is record 0, not record 1. With [b]LIMIT 1, 6[/b] you're skipping the first record returned by the query.
Copy linkTweet thisAlerts:
@nhoppingauthorMay 14.2006 — Thanks Man!

I'll try that!



[URL]http://www.nhopping.com[/URL]
×

Success!

Help @nhopping spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...