Forum Moderators: coopster

Message Too Old, No Replies

Crimemap script help

         

wxflint

7:12 pm on Aug 1, 2009 (gmt 0)

10+ Year Member



Hello all, This is not a weather related script but I know the people here are some of the best script coders. and have always been of great help here. so here we go.

I have an issue with an older crimemap script. this script allows users to sign up and post crime in there area and uses googles map and api to add the users crime in there area.
The issue i am having is that when a user signs up and then logs in They get this error here

Warning: Missing argument 1 for dbConnection::connect(), called in /home2/wxfriend/public_html/crime/login.php on line 27 and defined in /home2/wxfriend/public_html/crime/dbconnect.php on line 35

Warning: Missing argument 2 for dbConnection::connect(), called in /home2/wxfriend/public_html/crime/login.php on line 27 and defined in /home2/wxfriend/public_html/crime/dbconnect.php on line 35

Warning: Missing argument 3 for dbConnection::connect(), called in /home2/wxfriend/public_html/crime/login.php on line 27 and defined in /home2/wxfriend/public_html/crime/dbconnect.php on line 35

Warning: Missing argument 4 for dbConnection::connect(), called in /home2/wxfriend/public_html/crime/login.php on line 27 and defined in /home2/wxfriend/public_html/crime/dbconnect.php on line 35

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'wxfriend'@'localhost' (using password: NO) in /home2/wxfriend/public_html/crime/dbconnect.php on line 37
Unable to select database

The database config.php is set correct This might be an issue with the script hence it is an old script maybe outdated. I am using
Apache version2.2.11 (Unix)
PHP version5.2.9
MySQL version5.0.81-community
Operating systemLinux

Thanks in advance Please let me know if you need any other info.

[edited by: eelixduppy at 6:16 am (utc) on Aug. 2, 2009]

eelixduppy

6:32 am on Aug 2, 2009 (gmt 0)



Can you please elaborate on your situation here by posting some relevant code, starting with line 35 from dbconnect.php.

wxflint

8:05 pm on Aug 2, 2009 (gmt 0)

10+ Year Member



Thanks eelixduppy,
I have hence fixed the issue with adding the session_start()
to the top of the index.php file.
Line 35 was fixed by adding ($db->connect($host, $dbuser, $dbpwd, $dbname) instead of $db->connect();

Now I get this error when logged in clicking add activity and clicking submit I get this error

Warning: Invalid argument supplied for foreach() in /home2/wxfriend/public_html/crime/activity.php on line 50
Trouble with query!INSERT INTO crimemap_activity VALUES ('flint, mi 48506', '2009-10-12', 4, '60', , , 'this is a test')Added activity at flint, mi 48506

Line 50 of activity.php
foreach ($level2 as $key=>$value)

And on line 71 I see this
$query = "INSERT INTO crimemap_activity VALUES ('$address', '$datetime', $typeid, '$userid', $latitude, $longitude, '$description')";
$this->db->execute($query);

eelixduppy

12:18 pm on Aug 3, 2009 (gmt 0)



I'm not sure what is wrong with your query but for the foreach loop it looks like you are passing it $level2 which is not an array. Figure out why $level2 isn't becoming an array if it should be, otherwise add a condition to take alternate actions if it isn't an array using is_array [php.net]().