|
Posted by Kimmo Laine on 06/18/05 10:19
"Marceli Zaic" <marcus@sci.net.pl> kirjoitti
viestissδ:d8uctk$rts$1@nemesis.news.tpi.pl...
> hi,
> i'm newbe in this and i've problems
> i create page and connect to mysql server (also own build)
> i've problem with:
> 1. online user ,
> 2. counter
>
>
> kod:
> ....
> <?php
> $linkowanie = @mysql_connect("localhost","jurek","ogorek");
> if (!empty($linkowanie))
> {
> if(mysql_select_db("myslaw" , $linkowanie)==true)
> {
> $asql = "select * from opona";
> $aresult= mysql_query($asql,$linkowanie);
> if ($aresult==true)
> {
> while($arow=mysql_fetch_array($aresult))
> {
> $aNumer = $arow["suma"];
> }
> mysql_free_result($aresult);
> }
> $assql = "UPDATE opona SET suma=$aNumer+1";
> $asresult= mysql_query($assql,$linkowanie);
> if ($asresult==true)
> {
> $aqresult=mysql_insert_id($linkowanie);
> }
> }
>
> }
> mysql_close($linkowanie);
> ?>....
> .....
> <?php
> print("$aNumer");
> mysql_free_result($aqresult);
> ?>
> unfortunatelly the first problem is to heavy for me i don't know how begin
> it
> the second problem - when i implement the code (over) i became this
> message
>
> on top page
> Warning: mysql_close(): supplied argument is not a valid MySQL-Link
> resource
> in D:\Apache\Apache2\htdocs\index.php on line 178
If you place "mysql_close($linkowanie);" inside the if block which you used
to test if the link is valid, you shouldn't get warnings about it not being
valid. And you can always silence warnings:
@mysql_close($linkowanie); // the at-sign tells php to quit bitching about
things.
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
eternal.erectionN0@5P4Mgmail.com
Navigation:
[Reply to this message]
|