M
Matt
Guest
hi, I have the following php script:
<?php
$menLink=mysql_connect ($SQL_SERVER_NAME, $SQL_USER_NAME, $SQL_PASSWORD);
if (! $menLink ){
die("Could not connect to MySQL database");
}
mysql_select_db($SQL_DB_NAME)
or die ("Couldn't open $SQL_DB_NAME: ".mysql_error());
$squery="SELECT * FROM \"".$SQL_DB_PREFIX."\"mnuItems";
$result=(mysql_query($squery));
$num_rows=mysql_num_rows($result);
while ($a_row=mysql_fetch_row($result)){
foreach ($a_row as $field){
echo "$field, ";
}
echo "\n";
}
mysql_close($menLink);
?>
When I open the page, the following message appears:
<b>Warning</b>: mysql_num_rows(): supplied argument is not a valid MySQL result resource in <b>C:\Inetpub\wwwroot\arhs\new site\menubuild.php</b> on line <b>14</b>
Please could you help me, I seem to be unable to assign the $result variable!
Thanks.
<?php
$menLink=mysql_connect ($SQL_SERVER_NAME, $SQL_USER_NAME, $SQL_PASSWORD);
if (! $menLink ){
die("Could not connect to MySQL database");
}
mysql_select_db($SQL_DB_NAME)
or die ("Couldn't open $SQL_DB_NAME: ".mysql_error());
$squery="SELECT * FROM \"".$SQL_DB_PREFIX."\"mnuItems";
$result=(mysql_query($squery));
$num_rows=mysql_num_rows($result);
while ($a_row=mysql_fetch_row($result)){
foreach ($a_row as $field){
echo "$field, ";
}
echo "\n";
}
mysql_close($menLink);
?>
When I open the page, the following message appears:
<b>Warning</b>: mysql_num_rows(): supplied argument is not a valid MySQL result resource in <b>C:\Inetpub\wwwroot\arhs\new site\menubuild.php</b> on line <b>14</b>
Please could you help me, I seem to be unable to assign the $result variable!
Thanks.