Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: help with query
02-15-2009, 12:25 PM #1
- Join Date
- Feb 2009
- Thanked 0 Times in 0 Posts
help with query
Im having a few problems displaying results of a query.
Im currently developing a text based browser game, it has been made ready to play but I am introducing a 'lottery' to the game. So far I have made a script to empty the db table and then insert 6 randomly generated numbers, this script is on a cron to run every day. I have also done the user's input form where they pick 6 numbers and are saved to the db. Ive done all the validation to make sure they don't pick the same number twice and they have enough credits to buy the lotto ticket. I am currently working on a page where they can view all the tickets they have purchased.
I have the basic U.I on the left hand side and at the top of the page, with the current page displayed in the middle of the screen.
For all the other pages these codes are used:
$text .= "text in here";
$db = db_connect($database_host, $database_user, $database_password, $database, $database_persistent);
dbn(__FILE__,__LINE__,"select no1, no2, no3, no4, no5, no6 from lotto_tickets where login_id = '$user[login_id]' and login_name = '$user[login_name]'");
$text .= "<center>Tickets purchased so far:</center><br><br><table><tr><td>";
$text .= "No. 1</td><td>No. 2</td><td>No. 3</td><td>No. 4</td><td>No. 5</td><td>No. 6</td></tr>";
$text .= "<tr><td>$no1</td><td>$no2</td><td>$no3</td><td>$no4</td><td>$no5</td><td>$no6</td></tr>";
$text .= "</table>";
At the moment all Im getting is the column titles no entries from the db.
Of course there could be more than one entry from the user so the table would have to add another row for each entry.
Any help would be greatly appreciated.
02-15-2009, 03:14 PM #2
- Join Date
- Aug 2008
- On the way to the moon!
- Thanked 20 Times in 20 Posts
Few basic debugging required
1) echo your query and ensure you get the reqired values passed to the query from the variables
2) then, run this printed query on your DB and see if you get expected result...
Thank the user for his/her helpful post by clicking on the button below the post :)
~ LSK ~