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 01.05.2007   #1
gemacht
32-Bit Member
 
gemacht's Avatar
 
Data înregistrării: 30.12.2006
Locație: highway to HELL
Vârsta: 24
Mesaje: 131
Rep Power: 6
gemacht is on a distinguished road
Trimite un mesaj prin Yahoo pentru gemacht
Implicit eroare MySQL

Cod PHP:
function show_hide($id)
        {
             
$row=$this->select_one($id);
             if(!
$row)return false;
            
$rez=$this->query("update `guestbook` set show='".!$row['show']."' where id='".mysql_escape_string($id)."'");
            return 
$rez;
        } 
campul `show` este de tip BOOL. cand folosesc functia am eroarea asta :
Cod:
Fatal error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'show='1' where id='7'' at line 1 in D:\apache2triad\htdocs\new\admin\class\mysql.class.php on line 28
mysql.class.php :
Cod PHP:
    function query($sql)
        {
            
$this->sql=$sql;
            
$this->rez=mysql_query($this->sql);
    
linia 28 ->  if(!$this->rez)trigger_error(mysql_error(),E_USER_ERROR);
            return 
$this->rez;
        } 
am incercat tot ce mi-o venit in minte da nu am reusit sa scap de eroarea asta!

functia este folosita pentru a seta optiunea de a afisa sau nu pe site ce s-a scris in guestbook.
__________________
be FREE to LIVE

Last edited by gemacht; 01.05.2007 at 14:25:10.
gemacht is offline   Reply With Quote
Sponsored Links
Vechi 02.05.2007   #2
Zeon
32-Bit Member
 
Data înregistrării: 10.05.2006
Mesaje: 167
Rep Power: 7
Zeon is on a distinguished road
Implicit

pentru campurile varchar sintaxa corecta este:

... `camp`='valoare'

iar pentru int

... camp=valoare

Spor.
Zeon is offline   Reply With Quote
Vechi 02.05.2007   #3
Luxian
Spamofob
 
Luxian's Avatar
 
Data înregistrării: 26.06.2006
Locație: Timișoara
Vârsta: 25
Mesaje: 398
Rep Power: 6
Luxian is on a distinguished road
Trimite un mesaj prin Yahoo pentru Luxian
Implicit

[offtopic]
Citat:
În prealabil postat de Zeon
iar pentru int
... camp=valoare
Eu folosesc tot camp='valoare' si nu am primit nici o eroare pana acum, mi-am format deprinderea asta de cand am vazut ca si phpMyAdmin face la fel.

Care e diferenta intre ele?
[/offtopic]
__________________
www.luxian.ro | "Prieten e cel care te învață să pescuiești, nu cel care îți dă pește!"
Oo==oO | w210 owner
Luxian is offline   Reply With Quote
Vechi 04.05.2007   #4
gemacht
32-Bit Member
 
gemacht's Avatar
 
Data înregistrării: 30.12.2006
Locație: highway to HELL
Vârsta: 24
Mesaje: 131
Rep Power: 6
gemacht is on a distinguished road
Trimite un mesaj prin Yahoo pentru gemacht
Implicit

nu conteaza ghilimelele!
eroarea era la "show=" ... SHOW este cuvant rezervat
__________________
be FREE to LIVE
gemacht 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 01:04:37.


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

XXXXXXXXXXXXXXXXXXX
Inactive Reminders By Icora Web Design