ive been trying to figure out how to connect to a mysql database over a network. basically i have a page on one network using sharepoint and i have the database on my computer. i use xampp for my server on my computer. when i display the document on sharepoint (Network A) i dont get an error saying that it connot connect, but just get the text "$row['']" displayed on the page. i added the comp ip = localhost in the host file in system32\drivers\etc file. here is my code:
PHP Code:
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db name", $con);
$result = mysql_query("SELECT * FROM tablename");
while($row = mysql_fetch_array($result))
{
echo "<table border='0' width='100%'>";
echo "<tr>"
echo "<td width=3% align='left'><img src=\"" . $row['image']. "\"></td>";
echo "</tr>";
echo "</table>";
}
mysql_close($con);
?>
For the connect, ive tried connect("comp ip:3306","root",""); or 127.0.0.1:3306 or comp ip:3306@localhost. either way i dont get an error, just the ($row['image']) gets displayed in text, but nothing from the database.
what can be going wrong? oh yeah, sharepoint does use php
Bookmarks