Hello, this is very common question, but i really need help on this one.
I have a MySQL table that provides content for the particular web page. That webpage generates many hits (visits) so I need the fastest way to display the data selected from MySQL fields.
All fields are varchar, one field is longblob. Here is the example of the code that I'm currently using:
<?
$result=@("select * from news where naslovnica='da' order by id desc limit 40");
$numrows=@MYSQL_NUMROWS($result);
while($counter < $numrows) {
$datum = @MYSQL_RESULT($result,$counter,"datum");
$link = @MYSQL_RESULT($result,$counter,"link");
$newstext = @MYSQL_RESULT($result,$counter,"newstext");
$naslov = @MYSQL_RESULT($result,$counter,"naslov");
$tvrtka = @MYSQL_RESULT($result,$counter,"tvrtka");
$kategorija = @MYSQL_RESULT($result,$counter,"kategorija");
$slika = @MYSQL_RESULT($result,$counter,"slika");
$vrijeme = FncChangeTimestamp($datum,"DD-MM-2000");
$kategorija2 = urlencode("$kategorija");
?>
After that I display the results (the above code is obviously incomplete). I also could use arrays, but I don't see a significant progress. Example ...
<?
...
$sql_result = mysql_query($sql,$connection) or die ("Couldn't execute SQL
query");
while ($info = mysql_fetch_array($sql_result)) {
$naslov = $info["naslov"];
$link= $info ["link"];
...
?>
If the webpage has many visits, is it wise to open persistent (mysql_pconnect) MySQL connection?
I would appreciate any suggestion or advice!
Slaven