<html>
<head<title>Testing connection</title</head>
<body>
<h1>Testing connection</h1>
<?php
include "linkpassword.inc";
mysql_select_db("invfirst");
$result = mysql_query("SELECT itemno, itemname from itemfirsta where itemno = '12121'");
if (!$result)
{
print ("Problem with query: " . mysql_error());
exit;
}
$row = mysql_fetch_row($result);
echo "<br />";
echo $row[0];
echo "<br />";
echo $row[1];
?>
</body>
</html>
Testing connection
Connected successfullyProblem with query: Table 'invfirst.itemfirsta' doesn't exist
<html>
<head<title>Testing connection</title</head>
<body>
<h1>Testing connection</h1>
<?php
include "linkpassword.inc";
mysql_select_db("invfirst");
$result = mysql_query("SELECT itemno, itemname from itemfirst where itemno = '99887'");
$numRetrieve = mysql_num_rows($result);
if (!$result)
{
print (" - Problem with query: " . mysql_error());
exit;
}
if ($numRetrieve == 0)
{
print (mysql_error());
print ('problem');
exit;
}
$row = mysql_fetch_row($result);
echo "<br />";
echo $row[0];
echo "<br />";
echo $row[1];
?>
</body>
</html>
Testing connection
Connected successfully problem
<html>
<head<title>Testing connection</title</head>
<body>
<h1>Testing connection</h1>
<?php
include "linkpassword.inc";
mysql_select_db("invfirst");
$result = mysql_query("SELECT itemno, itemname from itemfirst where itemno = '99887'");
if (!$result)
{
print (" - Problem with query: " . mysql_error());
exit;
}
if ($row[0]=="")
{
print (" What? ");
exit;
}
$row = mysql_fetch_row($result);
echo "<br />";
echo $row[0];
echo "<br />";
echo $row[1];
?>
</body>
</html>
Testing connection
Connected successfully What?
<html>
<head<title>Testing connection</title</head>
<body>
<h1>Testing connection</h1>
<?php
include "linkpassword.inc";
mysql_select_db("invfirst");
$result = mysql_query("SELECT itemno, itemname from itemfirst where itemno = '12121'");
if (!$result)
{
print ("Problem with query: " . mysql_error());
exit;
}
$row = mysql_fetch_row($result);
echo "<br />";
echo $row[0];
echo "<br />";
echo $row[1];
?>
</body>
</html>
Testing connection
Connected successfully
12121
monitor
<html>
<head<title>Testing connection</title</head>
<body>
<h1>Testing connection</h1>
<?php
include "linkpassword.inc";
mysql_select_db("invfirst");
$result = mysql_query("SELECT * from itemfirst where itemno = '12121'");
if (!$result)
{
print ("Problem with query: " . mysql_error());
}
else
{
$row = mysql_fetch_row($result);
echo "<br />";
}
?>
<tr>
<td<?php echo $row[0]; ?</td>
<td<?php echo $row[1]; ?</td>
<td<?php echo $row[2]; ?</td>
<td<?php echo $row[3]; ?</td>
<td<?php echo $row[4]; ?</td>
</tr>
</body>
</html>
Testing connection
Connected successfully
12121 monitor 300.00 419.99 14
<?php
include "linkpassworddonor.inc";
mysql_select_db("donor2");
$result = mysql_query("SELECT idno from donor")
or die("Invalid query: " . mysql_error());
while ($row = mysql_fetch_array($result))
{
echo ("<p>ID= ". $row["idno"] ." </p>");
}
?>
Connected successfully
ID= 11
ID= 1234
From PHP manual:
mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both
Description
array mysql_fetch_array ( resource $result [, int $result_type= MYSQL_BOTH ] )
Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.
mysql_fetch_row — Get a result row as an enumerated array
Description
array mysql_fetch_row ( resource $result )
Returns a numerical array that corresponds to the fetched row and moves the internal data pointer ahead.