Previous Thread
Next Thread
Print Thread
Rate Thread
#210560 05/04/2001 3:36 PM
Joined: May 1999
Posts: 242
Coder
Coder
Offline
Joined: May 1999
Posts: 242
I'm stuck. I'm doing something wrong here and was hoping it would be obvious to folks more familiar with php than myself.

// # --------------------------
// # Let's grab the news items
$Newsboard_q = addslashes($newsboard);

$query = "
SELECT B_Number,B_Posted,B_Last_Post,B_Username,B_Subject,B_Body,B_Main
FROM w3t_Posts
WHERE B_Number = B_Main
AND B_Board = '$Newsboard_q'
ORDER BY B_Last_Post DESC
LIMIT $totalnews
";

$sth = $dbh -> do_query($query);
(the above line of code is where the error says it's happening, which I guess is referencing my database syntax... ?)

while ($rows = $dbh -> fetch_array($sth) ) {
list($Number,$Posted,$Last,$Username,$Subject,$Body,$Main) = $rows;
$dbh -> finish_sth($sth);


[]/testimages/icons/smile.gif[/] 6 []/testimages/icons/frown.gif[/]
Screamers

Sponsored Links
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262

while ( list($Number,$Posted,$Last,$Username,$Subject,$Body,$Main) = $dbh -> fetch_array($sth)) {


[:red]--------------
http://extremeforums.org

Joined: May 1999
Posts: 242
Coder
Coder
Offline
Joined: May 1999
Posts: 242
Tried your line without success. I don't think it's even getting to the while, which is after that database call...

This is the fatal error message:


Fatal error: Call to a member function on a non-object in main.inc.php on line 758

Line 758 is:

$sth = $dbh -> do_query($query);

of the block:

$Newsboard_q = addslashes($newsboard);

$query = "
SELECT B_Number,B_Posted,B_Last_Post,B_Username,B_Subject,B_Body,B_Main
FROM w3t_Posts
WHERE B_Number = B_Main
AND B_Board = '$newsboard'
ORDER BY B_Last_Post DESC
LIMIT $totalnews
$sth = $dbh -> do_query($query);

Not sure what I'm pulling out that it doesn't like.. scuse the expression... []/w3timages/icons/wink.gif[/]

[]/w3timages/icons/smile.gif[/] 6 []/w3timages/icons/frown.gif[/]
Screamers

Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
duh..... went home thought about it, you forgot closing bracket } lets see if it works now.

[:red]--------------
http://extremeforums.org

Joined: May 1999
Posts: 242
Coder
Coder
Offline
Joined: May 1999
Posts: 242
Forgot to define $dbh as a global near the top of the database call. []/testimages/icons/crazy.gif[/]

I'm learning... slowly... []/testimages/icons/laugh.gif[/]



[]/testimages/icons/smile.gif[/] 6 []/testimages/icons/frown.gif[/]
Screamers

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
badfrog
badfrog
somewhere on the coast of Maine
Posts: 94
Joined: March 2007
Forum Statistics
Forums63
Topics37,575
Posts293,932
Members13,824
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,835
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)