The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How can i fix this code, Php scripting
ThomasPosivy
post May 8 2012, 03:04 PM
Post #1





Group: Members
Posts: 7
Joined: 8-May 12
Member No.: 17,078



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>

This post has been edited by ThomasPosivy: May 8 2012, 03:07 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post May 8 2012, 03:06 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



What's the problem you want to have fixed? blink.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ThomasPosivy
post May 8 2012, 03:08 PM
Post #3





Group: Members
Posts: 7
Joined: 8-May 12
Member No.: 17,078



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ThomasPosivy
post May 8 2012, 03:10 PM
Post #4





Group: Members
Posts: 7
Joined: 8-May 12
Member No.: 17,078



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);

?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ThomasPosivy
post May 8 2012, 03:11 PM
Post #5





Group: Members
Posts: 7
Joined: 8-May 12
Member No.: 17,078



The info in the dbl.php is correct but it keeps 500ing on me every time.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ThomasPosivy
post May 8 2012, 03:17 PM
Post #6





Group: Members
Posts: 7
Joined: 8-May 12
Member No.: 17,078



am I missing something somewhere
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ThomasPosivy
post May 8 2012, 04:23 PM
Post #7





Group: Members
Posts: 7
Joined: 8-May 12
Member No.: 17,078



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post May 8 2012, 04:55 PM
Post #8


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



What messages appear in your server logs?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 8 2012, 05:19 PM
Post #9


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post May 8 2012, 05:42 PM
Post #10


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



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);

?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ThomasPosivy
post May 8 2012, 08:17 PM
Post #11





Group: Members
Posts: 7
Joined: 8-May 12
Member No.: 17,078



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>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 9 2012, 09:47 AM
Post #12


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



This line should still be removed:

CODE
<tr align="middle" valign="middle">
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th March 2024 - 10:02 PM