This is a discussion on "Problem with Programming" within the PHP Forum section. This forum, and the thread "Problem with Programming are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Problem with Programming
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Problem with Programming
Very classic Error, I have programmed this script for almost 14 days non stop now, so I think thats the reason why I canīt find the error
Error Code 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 's', ec = 0, deposit_id = 24' at line 7 Warning: Cannot modify header information - headers already sent by (output started at /MyHostName/deposit.account.confirm.inc:237) in /MyhostName/deposit.account.confirm.inc on line 240 PHP Script ą 236 until 243 '); (mysql_query ($q) OR print mysql_error ()); $user_id = $userinfo['id']; referral_commission ($user_id, $amount, $ec); header ('Location: ?a=deposit&say=deposit_success'); exit (); } Line 0-10 <? $ok = 1; $amount = sprintf ('%0.2f', $frm['amount']); $h_id = sprintf ('%d', $frm['h_id']); $type = $frm['type']; $ec = sprintf ('%d', substr ($frm['type'], 8)); $on_hold = 0; if ($settings['allow_withdraw_when_deposit_ends'] == 1) { $q = '' . 'select id from hm2_deposits where user_id = ' . $userinfo['id']; If you need more Details please let me know, The one who can solve this problem I may contact him in the Near future for a Interesting job offer. If interested ofcourse |
|
|
|
|||
|
Re: Problem with Programming
Your sql error is because the line, right of the '=' sign starts with a " but there is no closing " and following the opening " you have the concat operator but there is nothing to concatonate, as far as I can see.
As soon as a page starts being processed by the server, header information is sent unless you start your page with;
Once you have finished making decisions in your code that effect header information, you have the code;
|
|
|||
|
Re: Problem with Programming
Well the page on itself is not really a display Page, Header is not send directly
The page process a payment This is the complete page : <? $ok = 1; $amount = sprintf ('%0.2f', $frm['amount']); $h_id = sprintf ('%d', $frm['h_id']); $type = $frm['type']; $ec = sprintf ('%d', substr ($frm['type'], 8)); $on_hold = 0; if ($settings['allow_withdraw_when_deposit_ends'] == 1) { $q = '' . 'select id from hm2_deposits where user_id = ' . $userinfo['id']; ($sth = mysql_query ($q) OR print mysql_error ()); $deps = array (); $deps[0] = 0; while ($row = mysql_fetch_array ($sth)) { array_push ($deps, $row[id]); } $q = 'select sum(actual_amount) as amount from hm2_history where user_id = ' . $userinfo['id'] . ('' . ' and ec = ' . $ec . ' and deposit_id in (') . join (',', $deps) . ') and (type=\'earning\' or (type=\'deposit\' and (description like \'Compou%\' or description like \'<b>Archived transactions</b>:<br>Compound%\')));'; ($sth = mysql_query ($q) OR print mysql_error ()); while ($row = mysql_fetch_array ($sth)) { $on_hold = $row[amount]; } } if ($settings['hold_only_first_days'] == 1) { $q = '' . 'select hm2_deposits.id, hm2_types.hold from hm2_deposits, hm2_types where user_id = ' . $userinfo[id] . ' and hm2_types.id = hm2_deposits.type_id and ec=' . $ec . ' and hm2_deposits.deposit_date + interval hm2_types.hold day > now()'; } else { $q = '' . 'select hm2_deposits.id, hm2_types.hold from hm2_deposits, hm2_types where user_id = ' . $userinfo[id] . ' and hm2_types.id = hm2_deposits.type_id and ec=' . $ec; } ($sth = mysql_query ($q) OR print mysql_error ()); $deps = array (); $deps[0] = 0; while ($row = mysql_fetch_array ($sth)) { $q = 'select sum(actual_amount) as amount from hm2_history where user_id = ' . $userinfo['id'] . ('' . ' and ec = ' . $ec . ' and deposit_id = ' . $row[id] . ' and date > now() - interval ' . $row[hold] . ' day and (type=\'earning\' or (type=\'deposit\' and (description like \'Compou%\' or description like \'<b>Archived transactions</b>:<br>Compound%\')));'); ($sth1 = mysql_query ($q) OR print mysql_error ()); while ($row1 = mysql_fetch_array ($sth1)) { $on_hold += $row1[amount]; } } $q = '' . 'select * from hm2_types where id = ' . $h_id . ' and closed = 0'; ($sth = mysql_query ($q) OR print mysql_error ()); $type = mysql_fetch_array ($sth); $delay = -1; if (!$type) { $smarty->assign ('wrong_plan', 1); $ok = 0; } else { $plan_name = $type['name']; $smarty->assign ('plan_name', $plan_name); $delay += $type[delay]; } if ($delay < 0) { $delay = 0; } $use_compound = 0; if ($type['use_compound']) { if ($type['compound_max_deposit'] == 0) { $type['compound_max_deposit'] = $amount + 1; } if (($type['compound_min_deposit'] <= $amount AND $amount <= $type['compound_max_deposit'])) { $use_compound = 1; if ($type['compound_percents_type'] == 1) { $cps = preg_split ('/\\s*,\\s*/', $type['compound_percents']); $cps1 = array (); foreach ($cps as $cp) { array_push ($cps1, sprintf ('%d', $cp)); } sort ($cps1); $compound_percents = array (); foreach ($cps1 as $cp) { array_push ($compound_percents, array ('percent' => sprintf ('%d', $cp))); } $smarty->assign ('compound_percents', $compound_percents); } else { $smarty->assign ('compound_min_percents', $type['compound_min_percent']); $smarty->assign ('compound_max_percents', $type['compound_max_percent']); } } } $smarty->assign ('use_compound', $use_compound); $q = '' . 'select count(*) as col, min(min_deposit) as min from hm2_plans where parent = ' . $h_id; ($sth = mysql_query ($q) OR print mysql_error ()); $row = mysql_fetch_array ($sth); if ($row) { if ($row['col'] == 0) { $smarty->assign ('wrong_plan', 1); $ok = 0; } if ($amount < $row['min']) { $smarty->assign ('less_than_min', 1); $smarty->assign ('min_amount', number_format ($row['min'], 2)); $ok = 0; } } else { $smarty->assign ('wrong_plan', 1); $ok = 0; } $smarty->assign ('type', $frm['type']); $q = 'select sum(actual_amount) as sm, ec from hm2_history where user_id = ' . $userinfo['id'] . ' group by ec'; $sth = mysql_query ($q); while ($row = mysql_fetch_array ($sth)) { $exchange_systems[$row['ec']]['balance'] = $row['sm']; } $accounting = get_user_balance ($userinfo['id']); $max_deposit = $accounting['total']; $q = '' . 'select min(max_deposit) as min, max(max_deposit) as max from hm2_plans where parent = ' . $h_id; ($sth = mysql_query ($q) OR print mysql_error ()); $row = mysql_fetch_array ($sth); if ($row) { if (0 < $row['min']) { if ($row['max'] < $accounting['total']) { $max_deposit = $row['max']; } } } $ps = substr ($frm['type'], 8); if ($exchange_systems[$ps]['balance'] < $amount + $on_hold) { if ($amount <= $exchange_systems[$ps]['balance']) { $smarty->assign ('on_hold', 1); } else { $smarty->assign ('not_enough_funds', 1); } $max_deposit = $exchange_systems[$ps]['balance']; $ok = 0; } if ($max_deposit < $amount) { $smarty->assign ('max_deposit_less', 1); $smarty->assign ('max_deposit_format', number_format ($max_deposit, 2)); $ok = 0; } $smarty->assign ('ps', $exchange_systems[$ps]['name']); if (($ok == 1 AND $frm['action'] == 'confirm')) { $ec = $ps; $compound = sprintf ('%.02f', $frm['compound']); if ($use_compound) { if ($type['compound_percents_type'] == 1) { $cps = preg_split ('/\\s*,\\s*/', $type['compound_percents']); if (!in_array ($compound, $cps)) { $compound = $cps[0]; } } else { if ($compound < $type['compound_min_percent']) { $compound = $type['compound_min_percent']; } if ($type['compound_max_percent'] < $compound) { $compound = $type['compound_max_percent']; } } } $q = 'insert into hm2_deposits set user_id = ' . $userinfo['id'] . ('' . ', type_id = ' . $h_id . ', deposit_date = now(), last_pay_date = now() + interval ' . $delay . ' day, status = \'on\', amount = ' . $amount . ', actual_amount = ' . $amount . ', compound = ' . $compound . ', ec = ' . $ec . ' '); (mysql_query ($q) OR print mysql_error ()); $deposit_id = mysql_insert_id (); $q = 'insert into hm2_history set user_id = ' . $userinfo['id'] . ('' . ', amount = -' . $amount . ', actual_amount = -' . $amount . ', type=\'deposit\', date = now(), description = \'Deposit to ' . $plan_name . '\', ec = ' . $ec . ', deposit_id = ' . $deposit_id . ' '); (mysql_query ($q) OR print mysql_error ()); $user_id = $userinfo['id']; referral_commission ($user_id, $amount, $ec); header ('Location: ?a=deposit&say=deposit_success'); exit (); } $smarty->assign ('ok', $ok); $smarty->assign ('h_id', $h_id); $smarty->assign ('amount', number_format ($amount, 2)); $smarty->assign ('famount', $amount); $smarty->display ('deposit.account.confirm.tpl'); ?> |
|
|||
|
Re: Problem with Programming
It doesn't matter. The browser has made a call to the server to process this page and the server will make a response as soon as it starts unless you do as I suggested.
Try it and see. |
|
|||
|
Re: Problem with Programming
Parse error: syntax error, unexpected T_STRING in /my host/deposit.account.confirm.inc on line 10
and when I tried the other thing it works he deposit the Money, but he leaves the Undecided money Untouched what would mean that you could re deposit over and over Last edited by SuseLinux; Nov 3rd, 2006 at 16:23. |
|
|||
|
Re: Problem with Programming
You have a number of lines like this one with round brackets at either end that server no purpose and could be causing the T_STRING error message.
Fix all these and then see how things are. Your other problem sounds like a logic error. After you have fixed the above problems, if the other problem still exists, show me what the code now looks like and give me a clue as to where I should look. |
|
||||
|
Re: Problem with Programming
To reiterate Geoff's last message, it's a lot easier to read someone else's code if the syntax has maximum transparency. I'm not being at all critical -- for my own work, if it works and I understand it, all is well. But for someone else to read it (something I find hard to do anyway) -- well, it's just hard work to decipher this:
Quote:
Just to rewrite the first line
Sorry, wish I could be more help. Having a huge bunch of complex code not working right is major frustration. |
![]() |
| Tags |
| header, msql, php |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Some HTML programming questions | fmpfmpf | Web Page Design | 1 | Apr 15th, 2008 13:25 |
| Recursive programming in php | masha | PHP Forum | 4 | Oct 1st, 2007 12:37 |
| programming-designs.com | programming-designs | Free Web Site Critique | 5 | Aug 27th, 2006 19:31 |
| ASP/SQL programming help | squashed_Frog | Classic ASP | 3 | May 15th, 2006 03:49 |
| NewBie to Web Programming | ruwanr | Introduce Yourself | 7 | Dec 1st, 2005 20:32 |