codebang
Posts: 74
|
| Posted: 02/02/2009, 1:00 AM |
|
Hello all..
well.... i want to insert some date based on a choice.. i have added the button on my form and have added it to the onClick event. i have added the following code to it..
Please tell me where i went wrong:
//Custom Code @30-2A29BDB7
// -------------------------
$db= new clsDBTCSS();
$qry ="";
$job_number = $vw_tool_manifest_out->tsm_job_no->GetValue(true);
$qry="insert into tbl_manifest_det (tool_type,sub_type,serial_no) values
(select tsd_tool_type,tss_sub_type,tss_serial_no from vw_tool_manifest) where
job_number='".tsm_job_no."'";
echo $qry;
$db->query($qry);
// Closing the Database Connection
$db->close();
// -------------------------
//End Custom Code
Any help or any Ideas.
Thank you.
|
 |
 |
Gena
Posts: 591
|
| Posted: 02/02/2009, 1:47 AM |
|
1. What is your problem? What does not work?
2. Does your "insert" statement work corectly (if you for example go to mySQL Query and execute it)?
elso note, if you put
echo $qry;
then $db->query($qry); will not exectuted... So for test purpose you can use echo, but aftre comment it and test.
_________________
Gena |
 |
 |
mentecky
Posts: 321
|
| Posted: 02/02/2009, 3:15 AM |
|
codebang,
$qry="insert into tbl_manifest_det (tool_type,sub_type,serial_no)
select tsd_tool_type,tss_sub_type,tss_serial_no from vw_tool_manifest where
job_number=".$db->ToSQL($tsm_job_no, ccsText);
You don't need the VALUES keyword and the parens.
Hope that helps,
Rick
_________________
http://www.ccselite.com |
 |
 |
codebang
Posts: 74
|
| Posted: 02/02/2009, 5:07 AM |
|
ok
Well the code is perfect, but the button does not work and it does not even make that click sound....
when i check my DB there is no reflection of the code that was sent.
And what do u mean by parens?
Please help!
Thank you very much dude.
|
 |
 |
mentecky
Posts: 321
|
| Posted: 02/02/2009, 5:28 AM |
|
codebang,
I'm not sure why your button isn't working, perhaps the HTML got messed up. Try deleting it and recreating it in designer. Make sure you have a space between any other buttons. I have seen the <BEGIN> and <END> tags get nested and break things.
As to the "parens", I meant you didn't need the parentheses around the SELECT. Where they were placed it was messing up your WHERE clause.
Rick
_________________
http://www.ccselite.com |
 |
 |
codebang
Posts: 74
|
| Posted: 02/02/2009, 5:42 AM |
|
ok
first of all what values should this button have, should it have any operation like 'insert' or something relevant and the event that is being triggered, should it be on server side or client side.
keeping in mind that the job number is passed from the url as a parameter.
is there anything else i can try, or hev missed out
Thank you.
Salah Hafiz Midhat
|
 |
 |
mentecky
Posts: 321
|
| Posted: 02/02/2009, 6:06 AM |
|
codebang,
Leave operation blank. The code should be on the server side. When you click the button the page should refresh even if the code isn't working, that's why I say it sounds like an HTML issue.
Good Luck!
Rick
_________________
http://www.ccselite.com |
 |
 |
datadoit
|
| Posted: 02/02/2009, 6:23 AM |
|
Make sure it's indeed nested inside of your <form>. Otherwise, you'll
just have an HTML button that will never make it to any server.
Get used to working in that HTML tab almost as much as you work in the
Code tab. You'll find after using CCS for a while that you'll get
started with the Designer tab, then rarely revisit it later.
|
|
|
 |
codebang
Posts: 74
|
| Posted: 02/02/2009, 6:26 AM |
|
hey !!!
i ve deleted the old button and still no change on the DB.. what else could be wrong. can this be done in another way, instead of going for a button.
1 more thing, should the order of the data that is being inserted in the sql be in order, if not , data will not be saved.
Thank you.
CodeBang
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 02/02/2009, 7:25 AM |
|
Hey!!!
Have you looked at any of the code as datadoit suggests??
You really need to do that and try and sort out what is going on both in your HTML and PHP code.
Some basic troubleshooting needs to be done besides declaring it does not work.
We all are willing to help, but you really need to look at it in detail.
If you like, I would be happy to build your project for you. Let me know.
Have fun.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
DonP
|
| Posted: 02/04/2009, 10:42 AM |
|
As someone already pointed out, be sure your button is inside a form. A
button by itself will do nothing at all.
Don (DonP)
codebang wrote:
> Hello all..
>
> well.... i want to insert some date based on a choice.. i have added the button
> on my form and have added it to the onClick event. i have added the following
> code to it..
>
> Please tell me where i went wrong:
>
> //Custom Code @30-2A29BDB7
> // -------------------------
> $db= new clsDBTCSS();
> $qry ="";
> $job_number = $vw_tool_manifest_out->tsm_job_no->GetValue(true);
> $qry="insert into tbl_manifest_det (tool_type,sub_type,serial_no) values
> (select tsd_tool_type,tss_sub_type,tss_serial_no from vw_tool_manifest)
> where
> job_number='".tsm_job_no."'";
> echo $qry;
>
> $db->query($qry);
>
>
> // Closing the Database Connection
> $db->close();
> // -------------------------
> //End Custom Code
>
> Any help or any Ideas.
>
> Thank you.
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
|