I am working on an assignment that requires me to create a form that sends info to a database. I am having issues connecting to the server.
I have tried using mysql_connect and mysqli_connect and neither work.
mysql_connect error: Warning: mysql_connect(): Connection timed out
mysqli_connect error: Fatal error: Call to undefined function mysqli_connect()
$connect=mysql_connect("server.com","username","password","database")
or die("Failed to connect to server");
mysql_query("INSERT INTO client (title,fname,lname,organization,email,phone,tshirt) VALUES ($title,$fname,$lname,$org,$email,$phone,$tshirt)");
$tabledata = mysql_query("SELECT * FROM client");
echo "<table>
<tr>
<th>Title</th>
<th>First Name</th>
<th>Last Name</th>
<th>Organization</th>
<th>Email</th>
<th>Phone</th>
<th>TShirt</th>
</tr>";
while($row = mysql_fetch_array($tabledata)){
echo "<tr>";
echo "<td>" . $row['title'] . "</td>";
echo "<td>" . $row['fname'] . "</td>";
echo "<td>" . $row['lname'] . "</td>";
echo "<td>" . $row['org'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['phone'] . "</td>";
echo "<td>" . $row['tshirt'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($connect);
Info from PHP INFO
mysql
MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
PDO
PDO support enabled PDO drivers sqlite
pdo_sqlite
PDO Driver for SQLite 3.x enabled SQLite Library 3.7.7.1
sqlite3
SQLite3 support enabled SQLite3 module version 0.7 SQLite Library 3.7.7.1
Directive Local Value Master Value sqlite3.extension_dir no value no value
mysql_queryinterface?