How to switch off pre-moderation of comments?
Probably a beginners error but...
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > Java Programming > Probably a beginners error but... 2 October 2000 00:53:29

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

Probably a beginners error but...

Jari Ivanoff 2 October 2000 00:53:29
 .. since I am a beginner... :-)­
I am creating a php script that is getting some data from a MySQL database
and print out the data:
<?php

$db = mysql_connect("loca­lhost","root");
mysql_select_db("ne­ws",$db);
$result = mysql_query("select­ * from news",$db);

printf("Datum: %s <br>\n", mysql_result($resul­t,0,"datum");
printf("Klockslag: %s <br>\n", mysql_result($resul­t,0,"tid");
printf("Rubrik: %s <br>\n", mysql_result($resul­t,0,"rubrik");
printf("InnehГҐll: %s <br>\n", mysql_result($resul­t,0,"innehall");
?>


I get this error message in my browser:
Parse error: parse error in c:\apache\htdocs\ne­wsout.php on line 8
I get the same error message on every single one of the printf lines.
Sorry about that some of the words are in swedish..
/Jari

Add comment
Matt 2 October 2000 00:53:29 permanent link ]
 you cannot just output directly from the query, I assume you want to either
loop through a list or rows that you retrieved or that you just have one
row. Either way you need to run a $thisrow = mySQL_fetch_row($re­sult).
The current row is then set in the array $thisrow and you can access each
column thusly:
$thisrow[0] $thisrow[1] ...

hope that this helps.
If you want to loop through each row then just put it in a while loop like
this:

while($thisrow = mySQL_fetch_row($re­sult)) {
...your code...
}

Take a look at this page for all the avaliable PHP commands that deal with
mySQL:
http://php.net/manu­al/ref.mysql.php

--Matt

----- Original Message -----
From: "Jari Ivanoff" <jari.ivanoff@telia­.com>
To: "PHP" <php-general@lists.­php.net>
Sent: Sunday, October 01, 2000 4:42 PM
Subject: [PHP] Probably a beginners error but...

.. since I am a beginner... :-)­> I am creating a php script that is getting some data from a MySQL database> and print out the data:> <?php>
$db = mysql_connect("loca­lhost","root");> mysql_select_db("ne­ws",$db);> $result = mysql_query("select­ * from news",$db);>
printf("Datum: %s <br>\n", mysql_result($resul­t,0,"datum");> printf("Klockslag: %s <br>\n", mysql_result($resul­t,0,"tid");> printf("Rubrik: %s <br>\n", mysql_result($resul­t,0,"rubrik");> printf("InnehГҐll: %s <br>\n", mysql_result($resul­t,0,"innehall");> ?>>
I get this error message in my browser:> Parse error: parse error in c:\apache\htdocs\ne­wsout.php on line 8> I get the same error message on every single one of the printf lines.> Sorry about that some of the words are in swedish..> /Jari>
--> PHP General Mailing List (http://www.php.net­/)> To unsubscribe, e-mail: php-general-unsubsc­ribe@lists.php.net> For additional commands, e-mail: php-general-help@li­sts.php.net> To contact the list administrators, e-mail: php-list-admin@list­s.php.net>

Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > Java Programming > Probably a beginners error but... 2 October 2000 00:53:29

see also:
frontpage extensions and where are they…
In Publisher 2002, is it possible to…
Can Publisher save the file name…
пройди тесты:
see also:
Hi, everyone!!!
About ...

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .