GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 17-Jun-2005, 09:44
phpnewbie phpnewbie is offline
New Member
 
Join Date: Jan 2005
Posts: 10
phpnewbie is on a distinguished road

not a valid MySQL-Link resource


Thanks to many of you I have been able to connect the MySql database, and retrieve "part" of the database. I am now getting the error below, along with a couple of others, you can see them at http://resource.library.tmc.edu/Cart/index0610.php

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/html/Cart/index0610.php on line 17

I'm sure the seasoned PHP/MySQL person this is an easy answer, but I am new. Can you tell me what I'm missing. The database, file & column names are all correct and spelled correct. ;-)


PHP Code:

<?
require("Cart0527.php");
DBinfo();
Brand();
Root();
//connection to mysql host
$conn = @mysql_connect("$DBHost","$DBUser","$DBPass")or die (mysql_error());
//calling database to connect to within Mysql 
$db = mysql_select_db("$DBName");
$old=date("z")-1;
$query = "DELETE FROM Users WHERE Date < $old" ;
$query = "SELECT CartItemsID,Date FROM CartItems" ;
//line 17
$mysql_result = mysql_query("$DBName", "DELETE FROM Users WHERE Date < $old");
$mysql_result = mysql_query("$DBName","SELECT CartItemsID,Date FROM CartItems");

while ($row = mysql_fetch_row ($mysql_result)) {
$CII=$row[0];
$CDa=$row[1];
$pieces=explode(":",$CDa);
$DCHK=$pieces[1];
if ($DCHK < $old)

  #2  
Old 24-Jun-2005, 19:11
lukeyj lukeyj is offline
New Member
 
Join Date: Jun 2005
Posts: 1
lukeyj is on a distinguished road
I'm assuming all information is in the required file.

I'm not sure if it will help but if you've selected database i don't think you need to do it in every mysql query.

On functions list it shows this:

mysql_query ( string query [, resource link_identifier] )

No mention of DB name. So maybe your passing the string query as resource link_identifier. So therefore it could quite possibly like this:

$mysql_result = mysql_query("DELETE FROM Users WHERE Date < $old");
$mysql_result = mysql_query("SELECT CartItemsID,Date FROM CartItems");

I can't remember whether it's $conn or $db as resource link_identifier. If it's $conn then:

$mysql_result = mysql_query("DELETE FROM Users WHERE Date < $old", "$conn");
$mysql_result = mysql_query("SELECT CartItemsID,Date FROM CartItems", "$conn");
 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
High quality link building spogg Search Engine Optimization Forum 7 23-Aug-2006 11:41
Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More EyotaHosts Web Hosting Advertisements & Offers 0 28-Jun-2003 13:54
gzwrite(): supplied argument is not a valid stream resource in JdS MySQL / PHP Forum 2 24-Mar-2003 07:57

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:49.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.