How can i fix this code, Php scripting |
How can i fix this code, Php scripting |
ThomasPosivy |
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 |
pandy |
May 8 2012, 03:06 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
What's the problem you want to have fixed?
|
ThomasPosivy |
May 8 2012, 03:08 PM
Post
#3
|
Group: Members Posts: 7 Joined: 8-May 12 Member No.: 17,078 |
What's the problem you want to have fixed? 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 |
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); ?> |
ThomasPosivy |
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.
|
ThomasPosivy |
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
|
ThomasPosivy |
May 8 2012, 04:23 PM
Post
#7
|
Group: Members Posts: 7 Joined: 8-May 12 Member No.: 17,078 |
|
Darin McGrew |
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?
|
Christian J |
May 8 2012, 05:19 PM
Post
#9
|
. Group: WDG Moderators Posts: 9,650 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. |
pandy |
May 8 2012, 05:42 PM
Post
#10
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
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 |
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> |
Christian J |
May 9 2012, 09:47 AM
Post
#12
|
. Group: WDG Moderators Posts: 9,650 Joined: 10-August 06 Member No.: 7 |
This line should still be removed:
CODE <tr align="middle" valign="middle"> |
Lo-Fi Version | Time is now: 17th April 2024 - 09:02 PM |