Jump to content

MySQL-Link Error


lauram340

Recommended Posts

I have got an error but i don't understand what it means

My error says

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\Users\Laura\Desktop\UPDATE\UPDATE\Update\www\police\content\crud_single_table\confirm_insert.php on line 3

 

and my code is this

 

$sql = "SELECT COUNT(*) FROM Workshift WHERE NAME ='$a_name_variable'";
$result3= mysql_query($sql, $db);
$count= mysql_result($result3,0,"COUNT(*)");
if ($count >= 2)
{
	echo 'You are already working the max, 2 shifts.';
}

 

I can see its the mysql_query and mysql_result but how do i overcome this error and why is it saying its there?

Link to comment
https://forums.phpfreaks.com/topic/141916-mysql-link-error/
Share on other sites

This is in a file called confirm_insert and the database connection is on the index page elsewhere.

 

This is some more code that i was given to work on but don't what it means

 

<?php
$sql = "SELECT COUNT(*) FROM Workshift WHERE NAME ='$a_name_variable'";
$result3= mysql_query($sql, $db);
$count= mysql_result($result3,0,"COUNT(*)");
if ($count >= 2)
{
	echo 'You are already working the max, 2 shifts.';
}






$flag_insert = '';
if (isset($_REQUEST['flag_insert']))
{
	$flag_insert = $_REQUEST['flag_insert'];
}

if ($flag_insert == 'OK')
{


$query_insert = "Insert into ".$table." (";

$flag_position_in_query = 0;
for ($i = 0; $i < $columns; $i++)
{
	if (!(strstr(mysql_field_flags($result,$i),'primary_key')) and !(strstr(mysql_field_flags($result,$i),'timestamp')))
	{
		if ($flag_position_in_query > 0)
		{
			$query_insert = $query_insert.",".mysql_field_name($result,$i);
		}
		else
		{
			$query_insert = $query_insert.mysql_field_name($result,$i);
			$flag_position_in_query++;
		}
	}
}

Link to comment
https://forums.phpfreaks.com/topic/141916-mysql-link-error/#findComment-743065
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.