switching to mysqli

1Tsme1941

Member
Hi, I'm having trouble switching from mysql to mysqli. Help? thanks
============================================
code follows:
----------------------------
<?php?>
<html><body><div align=right>W</div></body></html>

//Open a new connection to the MySQL server
$mysqli = new mysqli('loclhost','root','','hoappsdb');
//Output any connection error
if ($mysqli->connect_error)
{die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);}

//MySqli Select Query
$results = $mysqli->query SELECT * FROM 'waitlist' Where entrytype='T'";

echo "<b>In House Add-Ons/Transfers<br><br>";

echo "<table border=1>";
echo "<tr>";

echo "<th>Appl#</th>";
echo "<th>Date</th>";
echo "<th>Time</th>";
echo "<th>Name</th>";
echo "<th>Race & Gender</th>";
echo "<th>Ethnicity</th>";
echo "<th>LH %</th>";
echo "<th>Displ.</th>";
echo "<th>Income Level</th>";
echo "<th>B/r s Needed</th>";
echo "<th>Movein Date</th>";
echo "<th>Removal Date</th>";
echo "<th>Code</th>";
echo "<th>Comments</th>";

echo "</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['appl'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $row['time'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['racegend'] . "</td>";
echo "<td>" . $row['ethnicity'] . "</td>";
echo "<td>" . $row['laborhsg'] . "</td>";
echo "<td>" . $row['displ'] . "</td>";
echo "<td>" . $row['incomelevel'] . "</td>";
echo "<td>" . $row['brneeded'] . "</td>";
echo "<td>" . $row['moveindate'] . "</td>";
echo "<td>" . $row['removaldate'] . "</td>";
echo "<td>" . $row['code'] . "</td>";
echo "<td>" . $row['comments'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
==================================================================
result follows:
------------------------
//Open a new connection to the MySQL server $mysqli = new mysqli('loclhost','root','','hoappsdb'); //Output any connection error if ($mysqli->connect_error) {die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);} //MySqli Select Query $results = $mysqli->query SELECT * FROM 'waitlist' Where entrytype='T'"; echo "In House Add-Ons/Transfers

"; echo " echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; while($row = mysql_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
Appl# Date Time Name Race & Gender Ethnicity LH % Displ. Income Level B/r s Needed Movein Date Removal Date Code Comments
" . $row['appl'] . " " . $row['date'] . " " . $row['time'] . " " . $row['name'] . " " . $row['racegend'] . " " . $row['ethnicity'] . " " . $row['laborhsg'] . " " . $row['displ'] . " " . $row['incomelevel'] . " " . $row['brneeded'] . " " . $row['moveindate'] . " " . $row['removaldate'] . " " . $row['code'] . " " . $row['comments'] . "
"; mysql_close(); ?>
 

1Tsme1941

Member
I made changes as I understood:
<html><body><center><b>In House Add-Ons/Transfers</b></center><br>
<?php
//Open a new connection to the MySQL server
$mysqli = new mysqli('localhost','root','','hoappsdb');
//Output any connection error
if ($mysqli->connect_error)
{die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);}

//MySqli Select Query
$results = $mysqli->query (SELECT * FROM waitlist Where entrytype='T'");

echo "<table border=1>";
echo "<tr>";

echo "<th>Appl#</th>";
echo "<th>Date</th>";
echo "<th>Time</th>";
echo "<th>Name</th>";
echo "<th>Race & Gender</th>";
echo "<th>Ethnicity</th>";
echo "<th>LH %</th>";
echo "<th>Displ.</th>";
echo "<th>Income Level</th>";
echo "<th>B/r s Needed</th>";
echo "<th>Movein Date</th>";
echo "<th>Removal Date</th>";
echo "<th>Code</th>";
echo "<th>Comments</th>";

echo "</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['appl'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $row['time'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['racegend'] . "</td>";
echo "<td>" . $row['ethnicity'] . "</td>";
echo "<td>" . $row['laborhsg'] . "</td>";
echo "<td>" . $row['displ'] . "</td>";
echo "<td>" . $row['incomelevel'] . "</td>";
echo "<td>" . $row['brneeded'] . "</td>";
echo "<td>" . $row['moveindate'] . "</td>";
echo "<td>" . $row['removaldate'] . "</td>";
echo "<td>" . $row['code'] . "</td>";
echo "<td>" . $row['comments'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
</body></html>

==================================================================
result follows:
------------------------
In House Add-Ons/Transfers

connect_error) {die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);} //MySqli Select Query $results = $mysqli->query (SELECT * FROM waitlist Where entrytype='T'"); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; while($row = mysql_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
Appl# Date Time Name Race & Gender Ethnicity LH % Displ. Income Level B/r s Needed Movein Date Removal Date Code Comments
" . $row['appl'] . " " . $row['date'] . " " . $row['time'] . " " . $row['name'] . " " . $row['racegend'] . " " . $row['ethnicity'] . " " . $row['laborhsg'] . " " . $row['displ'] . " " . $row['incomelevel'] . " " . $row['brneeded'] . " " . $row['moveindate'] . " " . $row['removaldate'] . " " . $row['code'] . " " . $row['comments'] . "
"; mysql_close(); ?>
 

JeroenE

New Member
You may have already solved this, but in case you haven't, here's a change you need: instead of using $row['appl'] and so on, use $row->appl
 
Top