Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in D:\Xitami\webpages\newphp2.php on line 37
this is an error i get when i run a php program. This is part of an online tutorial and i dont know if the database is wrong or what. I have tried to find some more information on it, but i suppose i cannot follow simple instructions...any help would be nice...thanks for bearing with me guys ;).
More PHP, ;) [Archive] - ForumsHQ
Re: More PHP, ;) [Archive] - ForumsHQ
\n";
echo "NamePosition\n";
while ($myrow = mysql_fetch_row($result)) {
printf("%s %s%s\n",
$myrow[1], $myrow[2], $myrow[3]);
}
echo "\n";
?>
thats the code for the page...that might help ;)
echo "NamePosition\n";
while ($myrow = mysql_fetch_row($result)) {
printf("%s %s%s\n",
$myrow[1], $myrow[2], $myrow[3]);
}
echo "\n";
?>
thats the code for the page...that might help ;)
Re: More PHP, ;) [Archive] - ForumsHQ
lemmi give it a lookie see....
put around your damn code so the BB displays it right....
put around your damn code so the BB displays it right....
Re: More PHP, ;) [Archive] - ForumsHQ
my bad... I'm a dumbass... just ignore my stupidity... lemmi look at it here
Re: More PHP, ;) [Archive] - ForumsHQ
first off DON'T USE PRINT!! use ECHO... its MUCH MUCH MUCH better!!!
Re: More PHP, ;) [Archive] - ForumsHQ
try using mysql_fetch_array($result) instead of mysql_fetch_row($result)
Re: More PHP, ;) [Archive] - ForumsHQ
heh i figured that part out now...i didnt fill the database, duh ;)
but now i have a new prob: this one is another one that should all me to start using the PHP_SELF function, that allows the page to call itself
Notice: Undefined variable: id in D:\Xitami\webpages\newphp2.php on line 15
Notice: Undefined variable: PHP_SELF in D:\Xitami\webpages\newphp2.php on line 41
Bob Smith
Notice: Undefined variable: PHP_SELF in D:\Xitami\webpages\newphp2.php on line 41
John Roberts
Notice: Undefined variable: PHP_SELF in D:\Xitami\webpages\newphp2.php on line 41
Brad Johnson
whats that all about?? code for page is as follows:
", $myrow["first"]);
printf("Last name: %s\n", $myrow["last"]);
printf("Address: %s\n", $myrow["address"]);
printf("Position: %s\n", $myrow["position"]);
} else {
// show employee list
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("%s %s\n", $PHP_SELF, $myrow["id"], $myrow["first"], $myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
hehe thanks alot ;)
but now i have a new prob: this one is another one that should all me to start using the PHP_SELF function, that allows the page to call itself
Notice: Undefined variable: id in D:\Xitami\webpages\newphp2.php on line 15
Notice: Undefined variable: PHP_SELF in D:\Xitami\webpages\newphp2.php on line 41
Bob Smith
Notice: Undefined variable: PHP_SELF in D:\Xitami\webpages\newphp2.php on line 41
John Roberts
Notice: Undefined variable: PHP_SELF in D:\Xitami\webpages\newphp2.php on line 41
Brad Johnson
whats that all about?? code for page is as follows:
", $myrow["first"]);
printf("Last name: %s\n", $myrow["last"]);
printf("Address: %s\n", $myrow["address"]);
printf("Position: %s\n", $myrow["position"]);
} else {
// show employee list
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("%s %s\n", $PHP_SELF, $myrow["id"], $myrow["first"], $myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
hehe thanks alot ;)
Re: More PHP, ;) [Archive] - ForumsHQ
hrm $_server['PHP_SELF'] perhaps??
Re: More PHP, ;) [Archive] - ForumsHQ
Notice: Undefined variable: id in D:\Xitami\webpages\newphp3.php on line 15
Notice: Undefined variable: _server in D:\Xitami\webpages\newphp3.php on line 41
Bob Smith
Notice: Undefined variable: _server in D:\Xitami\webpages\newphp3.php on line 41
John Roberts
Notice: Undefined variable: _server in D:\Xitami\webpages\newphp3.php on line 41
Brad Johnson
hehe thats the new errors, i dunno. I gotta get to bed now, so i wont be working on it much til tommorow AM, so dont worry about stressing too much. Thanks for the quick replies :D
Notice: Undefined variable: _server in D:\Xitami\webpages\newphp3.php on line 41
Bob Smith
Notice: Undefined variable: _server in D:\Xitami\webpages\newphp3.php on line 41
John Roberts
Notice: Undefined variable: _server in D:\Xitami\webpages\newphp3.php on line 41
Brad Johnson
hehe thats the new errors, i dunno. I gotta get to bed now, so i wont be working on it much til tommorow AM, so dont worry about stressing too much. Thanks for the quick replies :D
Re: More PHP, ;) [Archive] - ForumsHQ
whoa, fun. I changed it to have 'PHP_SELF' and now the error is:
Notice: Undefined variable: id in D:\Xitami\webpages\newphp3.php on line 15
Bob Smith
John Roberts
Brad Johnson
and the code of the page is:
", $myrow["first"]);
printf("Last name: %s\n", $myrow["last"]);
printf("Address: %s\n", $myrow["address"]);
printf("Position: %s\n", $myrow["position"]);
} else {
// show employee list
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("%s %s\n", 'PHP_SELF', $myrow["id"], $myrow["first"], $myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
fun huh? Ok, NOW i am going to bed!
http://www.chadlehmkuhl.slyip.com/newphp3.php
test her out see what it does, :D
Notice: Undefined variable: id in D:\Xitami\webpages\newphp3.php on line 15
Bob Smith
John Roberts
Brad Johnson
and the code of the page is:
", $myrow["first"]);
printf("Last name: %s\n", $myrow["last"]);
printf("Address: %s\n", $myrow["address"]);
printf("Position: %s\n", $myrow["position"]);
} else {
// show employee list
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("%s %s\n", 'PHP_SELF', $myrow["id"], $myrow["first"], $myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
fun huh? Ok, NOW i am going to bed!
http://www.chadlehmkuhl.slyip.com/newphp3.php
test her out see what it does, :D