RE: mysql insert problem (newbie)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason--

Thanks for the reply. 

I actually found my problem a couple of minutes ago.

In this function 

function store_data($value, $data, $week)
{
       global $user;
       global $db_connection;
       $query = "INSERT INTO results (results_id, winner_picked,
games_id,     
                 week_number, user_id)
                 VALUES('0', '$value', '1', '$week', '$user')";
       mysql_query($query, $db_connection);
       return mysql_affected_rows();
}

I had to add the "global $db_connection" because the $db_connection is
outside the scope of the function and thus it was not making a
connection to the database. Once this was changed, all works well.

Thanks again :-)

~damon

-----Original Message-----
From: Jason Wong [mailto:php-db@gremlins.biz] 
Sent: Friday, May 16, 2003 11:32 AM
To: php-db@lists.php.net
Subject: Re:  mysql insert problem (newbie)

On Friday 16 May 2003 08:09, M Damon Hill wrote:

>        mysql_query($query);

echo $query to check it is correct and:

  mysql_query($query) or die(mysql_error());

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
Staff meeting in the conference room in %d minutes.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux