Re: Urgent Help
| From: | Chad Morgan | Date: | Fri, 25 Aug 2000 02:57:20 +0000 |
| Subject: | Re: Urgent Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13565@lists.php.net to get a copy of this message | ||
I had this problem a while ago and I'm pretty sure this was my scenario and solution:
I had the following in an included file
function database_connect(){
$link = mysql_connect(...)
$db = mysql_select_db(...)
}
and then the following in the file I was working in:
database_connect();
$query = " ... ";
$result = mysql_query($query)
What I ended up doing was changing the database_connect function to return the link id like so, (which is probably the proper way to do it anyway):
function database_connect(){
$link = mysql_connect(...);
$db = mysql_select_db(...);
return $link;
}
and then included the link in the query like so:
$link = database_connect();
$query = "...";
$result = mysql_query($query, $link);
I'm pretty sure that is what did it though I'm not sure why, maybe someone else does.
Let me know what happens if that doesn't fix it I'll go back and look at the script and see what I did.
Chad Morgan
At 01:56 AM 8/24/00, CL Yong wrote:
When I upload a file, then try to connect database, I get this when doing mysql_query: Warning: 1 is not a MYSQL link index. WHY?? Does anybody can help me ?---------------------------------- Chad Morgan 877-988-1144 www.frontiercreations.comstep 1 : I want upload a file ( work)## step 2 : checking data eg. checking duplicate data ( Mysql error)step 3 : save into table ( work, if without step 2)p/s: The mysql query is ok, if I not put << enctype="multipart/form-data" >> in the html form.(but cannot upload file) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net