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
extra rows keep appearing
Old 02-06-2008, 03:58 PM extra rows keep appearing
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
in my function that displays rows( its on the front page by the way at http://ap-gfx.com) but at the bottom 2 rows their is no data i dont know what caused it please help
andyp is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-07-2008, 06:58 AM Re: extra rows keep appearing
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Show the code. Nobody knows how does your function behave and look like.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-07-2008, 03:44 PM Re: extra rows keep appearing
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
PHP Code:
function ListArticle()
  {
   
$mysql = @mysql_connect"localhost""USER""PASSWORD" );
 
   @
mysql_select_db"MY_DB" ); 
   
   if( !isset( 
$_GET['category'] ))
   { 
$sql "select * from articles order by date_added"; }
   else
   {
    
$cat $_GET['category'];
    
$sql "select * from articles where category='$cat' order by date_added";
    
   }
   if( isset( 
$_GET['category'], $_GET['subcategory'] ) )
   {
    
$cat $_GET['category'];
    
$sub $_GET['subcategory'];
    
$sql "select * from articles where category='$cat' and subcategory='$sub' order by date_added";
    }
   
   
$query mysql_query$sql ) or die( mysql_error());
   
   while( 
$row mysql_fetch_array$query ) )
   {
    
$title $row['title'];
    
$image $row['thumb'];
    
$text $row['text'];
    
$author $row['author'];
    
$date $row['date_added'];
    
$cat $row['category'];
    
$subcat $row['subcategory'];
    
$id $row['id'];
    
    
    echo( 
"<div class=\"listing\">");
    echo(
"<div class=\"image\">".$image."</div>");
    echo(
"<div class=\"textfloat\">");
    echo(
"<div class=\"title\"><b><a href=\"http://ap-gfx.com/article/id/".$id."\">".$title."</a></b></div>");
    echo(
"<div class=\"description\">".substr($text0120)."...</div>");
    echo(
"<div class=\"info\">author: ".$author." Date: ".$date." category: ".$cat." subcategory: ".$subcat."</div>");
    echo(
"</div>");
    echo(
"</div>");
   }
   
  } 
andyp is offline
Reply With Quote
View Public Profile
 
Old 02-08-2008, 02:20 AM Re: extra rows keep appearing
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Obviously you have two empty rows in your table.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-08-2008, 02:03 PM Re: extra rows keep appearing
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
I know that but they keep appearing as i have deleted them and they keep coming back a couple of days later.
andyp is offline
Reply With Quote
View Public Profile
 
Old 02-11-2008, 02:23 AM Re: extra rows keep appearing
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Obviously you need to check the code which is responsible for adding records into that table.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-11-2008, 07:02 PM Re: extra rows keep appearing
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
Its nots the code responsible for inserting records as the records appear a few days later.
p.s could you please stop starting every post with obviously
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE
andyp is offline
Reply With Quote
View Public Profile
 
Old 02-12-2008, 01:27 AM Re: extra rows keep appearing
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Well, in this case you deal with some kind of god power that adds records to your table.

Why should I stop starting each post with obviously if you are talking about things which are obvious? Your code definitely shows that there are no extra actions on your data array except selecting and echoing. If additional records appear in your table then they are inserted somewhere, find and fix it.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-12-2008, 02:31 AM Re: extra rows keep appearing
RadGH's Avatar
Skilled Talker

Posts: 76
Name: Radley
Trades: 0
Quote:
Originally Posted by mtishetsky View Post
Why should I stop starting each post with obviously if you are talking about things which are obvious?

Because your responses aren't obvious to people who don't understand what you are trying to explain

Rather than find the bug thats adding the rows and waiting to see if you fixed it, make some If...Else conditions to read the data of the row to be added. If its blank, just skip that row.

Hope that would apply to your layout though, I don't see any missing rows (perhaps you fixed it already?)
RadGH is offline
Reply With Quote
View Public Profile
 
Old 02-12-2008, 03:00 AM Re: extra rows keep appearing
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I always laugh a bit when someone says "obviously". Being a math dude, I was advised that "obviously" should almost never be used. Is it "obvious" that an even added with an even is also even? To you and I, perhaps, but mathematically-speaking, one must prove it. It may be "apparent", but only to those for whom training has been sufficient that the analysis is apparent.

Now, as for the error, it is likely that the insert script (which isn't given here) is inserting blank rows. Provide that and maybe we can be of additional assistance.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-12-2008, 08:05 AM Re: extra rows keep appearing
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
thanks, i will just do a bunch of if statements to do the displaying. the reason you cant see it anymore was i didnt want anyone to watch a site being built, so i stuck a redirect to my blog.


p.s about the controversy i've cause with the word "obviously" RadGH new why its annoying, also it make me feel kind of stupid
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE
andyp is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to extra rows keep appearing
 

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.45597 seconds with 12 queries