can someone help me figure out what this code is doing?

Hi Everyone,

I am getting an error from some PHP code that is telling me that i have an undefined index: 1477.

The PHP error is on line 289.

I do not know what <> or -= means in php/SQL

I have placed the code here :

[php]286 // check to see if the admin already confirmed some hours for a applicant/posting, if so remove those hours from our list
287 $results = mysql_query(“SELECT posting_id, application_id, confirmed_hours FROM allocations WHERE is_finalized <> 0 OR is_auto <> 1;”, $db) or db_error(LINE);
288 while ($postings = mysql_fetch_array($results)) {
289 $posting_hours[$postings[‘posting_id’]] -= $postings[‘confirmed_hours’];
290 $application_hours[$postings[‘application_id’]] -= $postings[‘confirmed_hours’];
291 $res2 = mysql_query(“DELETE FROM allocations WHERE posting_id=” . $postings[‘posting_id’] . " AND application_id=" . $postings[‘application_id’] . " AND tentative_hours=0 AND is_finalized=0 AN D is_auto=1;", $db) or db_error(LINE);
292 }
[/php]

MySQL database is returning this when i run the Query on line 287

[table]
[tr]
[td]posting_id application_id confirmed_hours
1477 1 67
1493 4 55
1493 3 55
1489 9 45
1480 10 45
1485 11 75
1486 8 45
1479 12 45
1491 13 80[/td]
[/tr]
[/table]

Thanks for you help

Halo

-= is subtraction

<> is not equals

The undefined index is from trying to use a value that has not been set.

Imortant!: You are using obsolete code and highly vulnerable to an SQL Injection attack. I could wipe out your entire database with that piece of code you posted.

DO NOT post where this app is located until you fix it.

Hi Kevin,

Thank you for your help.

I have plans to overhaul the application as soon as funding is approved.

Regards Halo

Sponsor our Newsletter | Privacy Policy | Terms of Service