Reply to Re: what do you think, why that?

Your name:

Reply:


Posted by Denis Gerina on 06/04/07 21:53

vinnie wrote:
> it only displays the name, but the last name and the address seems not
> to exist! why?
>
> <?php
> @ $db=mysql_pconnect('host', 'UserID', 'PWD');
> if (!$db)
> {
> echo 'conneciton eror';
> exit;
> }
> else
> {
> echo 'connection on!';
> }
> mysql_select_db('list');
> $query="select * from index";
> $result=mysql_query($query);
> $num_results=mysql_num_rows($result);
> if ($num_results == 0)
> {
> echo'<br><br>nothing to dispaly';
> }
> else
> {
> echo'<br><br>here are the results: '.$num_results;
> }
> for ($i<0; $i<$num_results; $i++)
> {
> $row=mysql_fetch_array($result);
> echo '<br>name: ';
> echo htmlspecialchars(stripslashes($row['name']));
> echo '<br>last name: ';
> echo htmlspecialchars(stripslashes($row['last']));
> }
> ?>
>
You don't seem to be printing address anywhere. As for last name, check
the name of the column in your table (index).

And, to avoid notices, the code

for ($i<0; $i<$num_results; $i++)

should be

for ($i=0; $i<$num_results; $i++)


Although I would probably write something like

while ($row = mysql_fetch_array($result))
{
....
}

[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

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