Phorum.ro
Your Avatar Welcome to Phorum.ro!
If you haven't registered yet, click here!
Attention Visitor:
You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Du-te înapoi   Phorum.ro > Web Design & Web Development > Programare > PHP > PHP DB

PHP DB Discutii despre lucrul cu baze de date in PHP.

Răspunde
 
Thread Tools Moduri de afișare
Vechi 13.04.2008   #1
Ciolitto
32-Bit Member
 
Data înregistrării: 05.02.2007
Mesaje: 31
Rep Power: 6
Ciolitto is on a distinguished road
Implicit Update Mysql

Am si eu o intrebare.. Nu pot face un update la baza de date

Citat:
$query="UPDATE utilizatori SET nume='$nume', prenume='$prenume' WHERE id='$user'";

$checkresult = mysql_query($query);
if ($checkresult) {
echo "Modificare efectuata";
} else {
echo "Modificare neefectuata";
}
mysql_close();
In script nu vad nici o greseala! Ma poate ajuta cineva?
________
Creampie porn

Last edited by Ciolitto; 27.03.2011 at 02:12:21.
Ciolitto is offline   Reply With Quote
Sponsored Links
Vechi 14.04.2008   #2
BETng4U
64-Bit member
 
BETng4U's Avatar
 
Data înregistrării: 21.02.2006
Locație: 127.0.0.1 - barlad
Vârsta: 23
Mesaje: 334
Rep Power: 6
BETng4U is on a distinguished road
Trimite un mesaj prin Yahoo pentru BETng4U
Implicit

foloseste mysql_error() sa vezi daca exista vreo eroare cauzata de interogarea ta.

poti folosi ceva de genu
Cod PHP:
                             $query="UPDATE utilizatori SET nume='$nume', prenume='$prenume' WHERE id='$user'"

$checkresult mysql_query($query);
$eroare=mysql_error();
if(
$eroare)
  echo 
'Erorare: ',$eroare;
else
  echo 
'Nici o eroare';

if (
$checkresult) {
echo 
"Modificare efectuata";
} else {
echo 
"Modificare neefectuata";
}
mysql_close(); 
succes
BETng4U is offline   Reply With Quote
Vechi 15.04.2008   #3
Ciolitto
32-Bit Member
 
Data înregistrării: 05.02.2007
Mesaje: 31
Rep Power: 6
Ciolitto is on a distinguished road
Implicit

Am reusit mersi mult numai ca am o alta problema la redirectionare folosesc

Citat:
header( 'Refresh: 3; url=/index.php' );
iar pe server (freehostia.com) imi da eroarea :


Citat:
Warning: Cannot modify header information - headers already sent by (output started at /home/www/site.freehostia.com/pagina.php:26) in /home/www/site.freehostia.com/pagina.php on line 27
Cu ce as putea inlocui si sa mearga???
________
Free xxx rated movies

Last edited by Ciolitto; 27.03.2011 at 02:12:33.
Ciolitto is offline   Reply With Quote
Vechi 15.04.2008   #4
Ciolitto
32-Bit Member
 
Data înregistrării: 05.02.2007
Mesaje: 31
Rep Power: 6
Ciolitto is on a distinguished road
Implicit

Am reusit mersi mult numai ca am o alta problema la redirectionare folosesc

Citat:
header( 'Refresh: 3; url=/index.php' );
iar pe server (freehostia.com) imi da eroarea :


Citat:
Warning: Cannot modify header information - headers already sent by (output started at /home/www/site.freehostia.com/pagina.php:26) in /home/www/site.freehostia.com/pagina.php on line 27
Cu ce as putea inlocui si sa mearga??? La mine pe calculator merge...
________
Is Just Begging To Get Her Pussy Stuffed

Last edited by Ciolitto; 27.03.2011 at 02:12:43.
Ciolitto is offline   Reply With Quote
Vechi 15.04.2008   #5
outkast
64-Bit member
 
outkast's Avatar
 
Data înregistrării: 06.02.2006
Locație: Romania
Vârsta: 26
Mesaje: 227
Rep Power: 7
outkast is on a distinguished road
Implicit

Scrie clar in mesaj care e buba.. scriptul tau a trimis ceva spre browser (poate fi un echo, o bucata de html sau chiar un spatiu uitat pe undeva) inainte ca tu sa apelezi functia header()...
Pune functia la inceputul scriptului.. vezi ca intre inceputul fisierului si tagul <?php sa nu fie cumva vreun spatiu..

Daca tot nu iti merge.. iti dau o functie pe care o folosesc in framework-ul meu.. incearca sa faca redirectarea prin 3 metode..
Cod PHP:
/** Performs a redirect.
*    Either as a HTTP header, or a <meta> tag or through javascript
*
*    @param $url string, the URL to redirect to
*    @param $delay integer, waith a number of seconds before redirecting (default is 0)
*    @return void
**/
function redirect($url$delay=0)
{
    if(!
headers_sent() && $delay==0)
    {
        
header("Location: {$url}"true);
    }
    else
    {
        echo 
"<script type=\"text/javascript\">setTimeout(\"window.location = '{$url}'\", {$delay});</script>";
        echo 
"<meta http-equiv=\"refresh\" content=\"{$delay};url={$url}\">";
    }
    exit;

PS: citeste despre output buffer (functiile ob_*) in php si foloseste-l, pe mine ma scapa de multe dureri de cap
__________________
A good Manager will take you through the forest, no mater what. A Leader will take time to climb on a tree and say 'This is the wrong forest'

blog.florindinu.ro - Another boring blog
outkast is offline   Reply With Quote
Vechi 15.04.2008   #6
Ciolitto
32-Bit Member
 
Data înregistrării: 05.02.2007
Mesaje: 31
Rep Power: 6
Ciolitto is on a distinguished road
Implicit

Ms mult, da intradevar avea un echo inainte dar imi trebuie... Am folosit pana la urma <meta .... si merge cu el! Multumesc inca o data ca m-ati ajutat
________
Bbw movie

Last edited by Ciolitto; 27.03.2011 at 02:12:50.
Ciolitto is offline   Reply With Quote
Răspunde


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Moduri de afișare

Reguli de postare
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Pornit
emoticoanele sunt Pornit
Codul [IMG] este Pornit
Codul HTML este Oprit



Ora este GMT +3. Ora este acum 15:03:36.


Rulează cu: vBulletin Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Forum SEO by Zoints

XXXXXXXXXXXXXXXXXXX
Inactive Reminders By Icora Web Design