View Single Post
Old 05-10-2007, 01:41 AM   #2 (permalink)
CrazeD
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: mysql_query(): supplied argument is not a valid MySQL-Link resource in...

Code:
<?php

$mysql = mysql_connect ('localhost','userid','pw','database');
if (!$mysql) {
	die ('Could not connect: '.mysql_error().'');
} else {
	
	$display_block = 'Name to find is '.$_POST['name'].'<br />';
	$namesearch_sql = 'SELECT * FROM tbl_guests WHERE guest_name LIKE '{$_POST['name']}'';
		if ($namesearch_res = mysql_query ($namesearch_sql)) { // Run the query
			if (mysql_num_rows ($namesearch_res) < 1) {
				$display_block .= "no name";
			} else {
				$display_block = "name found.";
			}
			
		} else { // Query didn't run
			die ('<p>Error: '.mysql_error().'</p>');
		}

mysql_close();

?>
I re-wrote it for you, a little neater. See if it works.
__________________

Need website help? PM me!
CrazeD is offline