php + mySQL query problem

Status
Not open for further replies.

clm100

Ars Legatus Legionis
13,874
Subscriptor
This code produces an error on line 8 (while...). Any ideas why? I'm fairly sure the syntax is correct, so what's the issue?
code:<HR>
Code:
<html>
<body>
<?php
$db = mysql_connect("localhost","/*no you can't find out who I am */","/*nor my password!*/");
mysql_select_db("ben",$db);
$query = "SELECT * FROM scheds WHERE p7 LIKE 17440003";
$results = "mysql_query($query,$db)";
while ($myrow = mysql_fetch_array($results)) {
	/* printf ("%s
", $myrow["uname"]); */
	$uname = $myrow["uname"];
	echo "$uname";
}
?>
</body>
</html>

As soon as I get it working hard coded like that, I'll replace the query with variables, so it'll be more useful than for this one search.

[This message was edited by clm100 on January 30, 2002 at 19:25.]
 

clm100

Ars Legatus Legionis
13,874
Subscriptor
code:<HR>
Code:
<html>
<body>
<?php
$db = mysql_connect("localhost","/*don't try it*/","/*shuddup*/");
mysql_select_db("ben",$db);
$query = "SELECT * FROM scheds WHERE $class LIKE $course";
$results = mysql_query($query,$db);
while ($myrow = mysql_fetch_array($results)) {
	$uname = $myrow["uname"];
		$queryn = "SELECT * FROM userinfo WHERE uname LIKE $uname";
		$resultsn = mysql_query($queryn,$db);
		$myrown = mysql_fetch_array($resultsn);
		$fname = $myrown["fname"];
		$lname = $myrown["lname"];
		$class = $myrown["class"];
	echo "$uname $fname $lname $class
\n";
}
?>
</body>
</html>

It returns there usernames all fine and dandy, but it won't return the rest of the information for the second table.
Warning: Supplied argument is not a valid MySQL result resource in /pinky/httpd/bnc/php/debby.php on line 12
tdelgado
tdelgado is the username...
 
Status
Not open for further replies.