If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Newbie - Getting Warnings.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-03-04, 00:19
adamkempa adamkempa is offline
Registered User
 
Join Date: Aug 2004
Posts: 1
Exclamation Newbie - Getting Warnings.

Hello all,
I'm new to mysql, but I've managed to cobble together a script that does everything exactly as I want it to. The problem is I'm getting Warnings when I run through certain loops in the script, but I don't see any errors.

Here is the warning:

Code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.fitch/awkemp/kempa.com/aadl/index.phtml on line 33
...and here is the general area of line 33 in the code:


Code:
if ($endses) {

		if (!$stationnumber || strlen($stationnumber) > 1 || $stationnumber > 3 || ereg("^[[:alpha:]]$", $stationnumber) || ereg("^[-!#@$%&\'\;:<>?\|*~+\\./0-]$", $stationnumber)){
			echo "<center>Invalid station number entered.<P><a href=\"index.phtml\">Back</a></center>";
		}
		else{
	
			$result = mysql_query("SELECT * FROM stations",$db);
		
			while($myrow = mysql_fetch_array($result)){ 

				if ($myrow["id"] == $stationnumber && $myrow["status"] != 'Out of order') {
		
					echo "<center>Session Ended.<P>";
				
					echo "<a href=\"index.phtml\">Back</a><P></center>\n";
		
					$id = $myrow["id"]; 

					$sql = "UPDATE stations SET cardnumber=NULL,last=NULL,first=NULL,status='Available' WHERE id=$id";

					$result = mysql_query($sql,$db); 
				}
		
				else{
				
					if ($myrow["id"] == $stationnumber) {
				
						echo "<center>Station is out of order. No session exists.<P><a href=\"index.phtml\">Back</a></center>";
				
					}
				}

			}
		
		}
	}
Any Suggestions?
I can post the rest of the code if neccesary.
Thanks!
Adam
Reply With Quote
  #2 (permalink)  
Old 08-03-04, 13:12
yellowmarker yellowmarker is offline
Registered User
 
Join Date: Jul 2004
Location: Dundee, Scotland
Posts: 107
is your code in a function? have you made $result a global?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On