Reply to Re: Database Retrival Problem

Your name:

Reply:


Posted by fiziwig on 03/25/06 09:24

There's so much code there I'm not sure which part you're having
trouble with, but there's a few things that look suspicious...

// GETTING KEYWORDS HERE
$query_kwds = "SELECT * FROM moviedb ORDER BY date ASC";
$result_kwds = mysql_query($query_kwds);
while($rs = mysql_fetch_array($result_kwds)) {
$akey = $rs['title'];
//$akey = "$mtitle, ";
}
As near as I can tell, this piece of code accomplishes nothing
whatsoever. It assigns a value to $akey and then overwrites that values
the next time through the loop without ever doing anything with the
value. Seems like a complete waste of time.

I think what you intended was $akey[]=$rs['title']; which adds the next
keyword to the array $akey. Without the square brackets $akey is a
scalr, not an array.

Also, if 'title' is the only thing you're using you should say

$query_kwds = "SELECT title FROM moviedb ORDER BY date ASC";

instead of dragging all the db fields into memory. And if you only want
10 of them you should at a LIMIT clause, or else you will load the
entire contents of the database into the meta tag.

for this bit:

$q_count = mysql_query("SELECT * FROM moviedb");
$totalrows = mysql_num_rows($q_count);

This would consume a lot less memory and probably run quite a bit
faster:

$q_count = mysql_query("SELECT COUNT(*) FROM moviedb");
$row = mysql_fetch_array($q_count, MYSQL_NUM);
$totalrows = $row[0];

Take my advice with a grain of salt. I've only been using php for 8
days now, so I'm no expert.

--gary

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация