HELP......php

kkml

Member
Jan 22, 2013
99
4
0
machan mama php walin project ekak karanawa.but podi case ekak:no::no:.eke mokak hari liyanakota & mark ekath ekka text ekak dammoth sql error ekak enawane :no::no::no:ban.charector ekak replace nokara wena mokak hari methoed ekak dannawanam kiyanawada?:D:D


Thnaks All......
 

kkml

Member
Jan 22, 2013
99
4
0
mekai hithapanko mama database eke table ekata Subjects tikak add karanawa kiyala.mama Social studies & history kiyala dammoth oya & mark eken sql eka kadenawane ban.mama ekata wena charecter ekak replace karala database ekata daganne.wena vidihak tiyenawanam kiyapalla machan.loku help ekak
 

JVG

Active member
  • Apr 23, 2009
    377
    25
    28
    umba kiyanne Insert query eka athuleda? kohetada oya "Social studies & history" kiyala danne?
     

    kkml

    Member
    Jan 22, 2013
    99
    4
    0
    machan hadapu ekak na.mekai table ekak tiyenawa hitapanko tbl_subject kiyala.oke field ekak tiyey str_subject kiyala.mama query ekakin yawanawa insert into tbl_subject(str_subject) values ('social studies & History') ;);)
     

    kkml

    Member
    Jan 22, 2013
    99
    4
    0
    umba kiyanne Insert query eka athuleda? kohetada oya "Social studies & history" kiyala danne?



    machan hadapu ekak na.mekai table ekak tiyenawa hitapanko tbl_subject kiyala.oke field ekak tiyey str_subject kiyala.mama query ekakin yawanawa insert into tbl_subject(str_subject) values ('social studies & History') ;);)
     

    kosandpol

    Well-known member
  • Jun 10, 2008
    45,329
    1,492
    113
    machan hadapu ekak na.mekai table ekak tiyenawa hitapanko tbl_subject kiyala.oke field ekak tiyey str_subject kiyala.mama query ekakin yawanawa insert into tbl_subject(str_subject) values ('social studies & History') ;);)
    ඔහොම data save කරන්න එපා. ඕක query කරන්න ගියාම පිස්සු හැදෙයි. එකම subjects repeat වෙනවා නං subjects Master table එකක් හදලා වෙන table එකක student number එකට subject Codes save කරගන්න.
     

    kkml

    Member
    Jan 22, 2013
    99
    4
    0
    ඔහොම data save කරන්න එපා. ඕක query කරන්න ගියාම පිස්සු හැදෙයි. එකම subjects repeat වෙනවා නං subjects Master table එකක් හදලා වෙන table එකක student number එකට subject Codes save කරගන්න.



    eka hari machan duplicate danna denna ewa handa karala tiyenne mata tiyena problem eka & mark eka ban.ubata puluwannam testing table ekakata dala balapan.thank you machan
     

    OnDaRock

    Well-known member
  • Feb 21, 2010
    938
    610
    93
    machan mama mage PHP ekka MySQL wala oka try kala. Awlak nethuwa weda. Version ekka okkoma detail daanna balamu moko case eka kiyala.

    WAMP, XAMP wage mona hari paawichchi karanawada ?

    poddak kokatath menna mehema karala balahan machan.

    $manufacturer = mysql_real_escape_string($manufacturer);
    mysql_query("insert into db_manufacturer(mfgName) values('$manufacturer')"

    got from stackoverflow
     

    OnDaRock

    Well-known member
  • Feb 21, 2010
    938
    610
    93
    machan direct query eka phpmyadmin hari moken hari gehuwahama weda karanawada ??
    error enawanm kiyanna.

    PHP walin run karahama ena error eka mokadda ??

    please copy paste the error ..
     

    kosandpol

    Well-known member
  • Jun 10, 2008
    45,329
    1,492
    113
    eka hari machan duplicate danna denna ewa handa karala tiyenne mata tiyena problem eka & mark eka ban.ubata puluwannam testing table ekakata dala balapan.thank you machan
    උඹට මම කියපු එක තේරුනෙ නෑ වගෙ..
    ඔය විදියට save කරන්න ඕනෙම නං \& හැටියට යවන්න.
    Code:
    insert into tbl_subject(str_subject) values ('social studies \& History')
     

    kkml

    Member
    Jan 22, 2013
    99
    4
    0
    ඔහොම data save කරන්න එපා. ඕක query කරන්න ගියාම පිස්සු හැදෙයි. එකම subjects repeat වෙනවා නං subjects Master table එකක් හදලා වෙන table එකක student number එකට subject Codes save කරගන්න.

    ow machan.mehemai
    menna mehema page ekak kiyala hitapanko

    90793255.jpg



    mama subject table ekak hadala tiyenne.mama othana test & test kiyala subject ekak dammoth tamai case eka enne.mama danata oya & mark eka wenuwata wena charector ekak replace kara.
    mama variyable ekak hadala mysql_real_escape_string(variable)
    damma eka hari yanna machan.wena vidihak tiyenawanam hodai.
     

    kkml

    Member
    Jan 22, 2013
    99
    4
    0
    please give the error message u r getting or give me the php code with the db dump


    machan "txt_subject" kiyanne textbox eke name eka.

    mama tempary use kara mehema
    $subjet_name=str_replace("&","$",$_POST["txt_subject"])

    mysql_real_escape_string($_POST["txt_subject"]) hari yaida machan
     

    OnDaRock

    Well-known member
  • Feb 21, 2010
    938
    610
    93
    Yeah but I do not think you have to replace the & value with $ since what if u have to put $ sign there in DB.

    Please give me the error message you are getting or the PHP file. and tell more details about the PHP version and the DBMS you are using.

    The issue here is I have tried as you said but it works fine for me.
     
    Last edited:

    kkml

    Member
    Jan 22, 2013
    99
    4
    0
    Yeah but I do not think you have to replace the & value with $ since what if u have to put $ sign there in DB.

    Please give me the error message you are getting or the PHP file. and tell more details about the PHP version and the DBMS you are using.

    The issue here is I have tried as you said but it works fine for me.

    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established