Help - Search - Members - Calendar
Full Version: How can i fix this code
HTMLHelp Forums > Programming > Server-side Scripting
ThomasPosivy
Many Thanks!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>

<Center><h1>BitDraw</h1></Center>
<tr align="middle" valign="middle">

<?php

include('dbl.php');

$sqlget = "SELECT * FROM Pot";
$sqldata = mysqli_query($dbcon, $sqlget) or die('could not retrieve data')


echo "<table>";
echo "<tr><th>Person ID</th><th>Bid ID</th><th>Amount</th><th>Confirmed</th>

while($row = mysqli_fetch_array($sqldata, MYSQLI_ASSOC)) {
echo "<tr><td>";
echo $row['Person ID'];
echo "</td><td>";
echo $row['Bid ID'];
echo "</td><td>";
echo $row['Amount'];
echo "</td><td>";
echo $row['Confirmed'];
echo "</td></tr>"
echo "</table>";
}
?>


</body>
</html>
pandy
What's the problem you want to have fixed? blink.gif
ThomasPosivy
QUOTE(pandy @ May 8 2012, 04:06 PM) *

What's the problem you want to have fixed? blink.gif


This part <?php

include('dbl.php');

$sqlget = "SELECT * FROM Pot";
$sqldata = mysqli_query($dbcon, $sqlget) or die('could not retrieve data')


echo "<table>";
echo "<tr><th>Person ID</th><th>Bid ID</th><th>Amount</th><th>Confirmed</th>

while($row = mysqli_fetch_array($sqldata, MYSQLI_ASSOC)) {
echo "<tr><td>";
echo $row['Person ID'];
echo "</td><td>";
echo $row['Bid ID'];
echo "</td><td>";
echo $row['Amount'];
echo "</td><td>";
echo $row['Confirmed'];
echo "</td></tr>"
echo "</table>";
}
?>

It keeps giving me a 500 error on my website
ThomasPosivy
this is what it grabs from dbl.php
<?php

DEFINE ('DB_USER', 'ThomasPosivy');
DEFINE ('DB_PSWD', 'tyhui123');
DEFINE ('DB_HOST', 'hostingdb.gotonames.com');
DEFINE ('DB_NAME', 'BitDraw');

$dbcon = mysqli_connect(DB_HOST, DB_USER, DB_PSWD, DB_NAME);

?>
ThomasPosivy
The info in the dbl.php is correct but it keeps 500ing on me every time.
ThomasPosivy
am I missing something somewhere
ThomasPosivy
QUOTE(pandy @ May 8 2012, 04:06 PM) *

What's the problem you want to have fixed? blink.gif


Is there anyone on this site that can help? smile.gif
Darin McGrew
What messages appear in your server logs?
Christian J
CODE
include('dbl.php');

What does dbl.php contain?

CODE
$sqldata = mysqli_query($dbcon, $sqlget) or die('could not retrieve data')

The line above should have an ending semicolon.

CODE
echo "<tr><th>Person ID</th><th>Bid ID</th><th>Amount</th><th>Confirmed</th>

The line above should have an ending quote and semicolon.

But I don't think the above would cause an Error 500 server response. Maybe it's due to the database.

BTW the HTML is pretty invalid too.
pandy
QUOTE(Christian J @ May 9 2012, 12:19 AM) *

CODE
include('dbl.php');

What does dbl.php contain?



CODE
<?php

DEFINE ('DB_USER', 'ThomasPosivy');
DEFINE ('DB_PSWD', 'tyhui123');
DEFINE ('DB_HOST', 'hostingdb.gotonames.com');
DEFINE ('DB_NAME', 'BitDraw');

$dbcon = mysqli_connect(DB_HOST, DB_USER, DB_PSWD, DB_NAME);

?>
ThomasPosivy
Thank you all very much

i have solved my code problem with your help.

surprisingly it did cause the 500 error. lol
i just add a few ; and () and , and "" and i was good.

Fixed:

<html>
<body>

<Center><h1>BitDraw</h1></Center>
<tr align="middle" valign="middle">

<?php

include_once(dbl.php);

$sqlget = "SELECT * FROM Pot";
$sqldata = "mysqli_query($dbcon, $sqlget) or die('could not retrieve data')";

echo "<table>";
echo "<tr><th>Person ID</th><th>Bid ID</th><th>Amount</th><th>Confirmed</th>";

while($row = mysqli_fetch_array($sqldata, MYSQLI_ASSOC)); {
echo "<tr><td>";
echo $row ['Person ID'];
echo "</td><td>";
echo $row ['Bid ID'];
echo "</td><td>";
echo $row ['Amount'];
echo "</td><td>";
echo $row ['Confirmed'];
echo "</td></tr>";
echo "</table>";
}
?>


</body>
</html>
Christian J
This line should still be removed:

CODE
<tr align="middle" valign="middle">
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.