$db->sql_ queries just not working!

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
taifunbrowser
Registered User
Posts: 60
Joined: Sun Sep 10, 2006 2:09 am
Contact:

$db->sql_ queries just not working!

Post by taifunbrowser » Sun Mar 16, 2008 5:46 pm

Code: Select all

if ($userdata['user_level']==1){ //ADMIN

//MAKE
$sql = "CREATE TABLE IF NOT EXISTS smdb (simid int unsigned NOT NULL auto_increment,PRIMARY KEY(simid),userid int unsigned NOT NULL,songname varchar(45) NOT NULL,subtitle varchar(45) NOT NULL,artist varchar(45) NOT NULL,activity TIMESTAMP(8),created TIMESTAMP DEFAULT NOW(),info text)";
	$sqlres = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($sqlres)){
	$plug = $plug . '<br>' . print_r($row,true) . 'hi!';
}

//INSERT
$sql = "INSERT INTO smdb VALUES('','2','Happy File','remix','xerox','','')";
	$sqlret = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($sqlret)){
	$plug = $plug . '<br>' . print_r($row,true) . '<br> hi!';
$plug = $plug . 'returned nothing.';
}

//SELECT
$sql = 'SELECT * FROM smdb';
	$sqlret = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($sqlret)){
	$plug = $plug . '<br>' . print_r($row,true) . '<br> hi!';
}

$plug = $plug. 'made it';
} //end is admin
'made it' is added to $plug, but nothing else!!! I'm trying to add custom capability to my forums, and I'm just copy and pasting other phpbb code, but I can't get it to work for me :(

Thanks for helping, if you would!

User avatar
Jim_UK
Former Team Member
Posts: 18478
Joined: Tue Oct 12, 2004 5:36 pm
Location: Darwen N.West UK

Re: $db->sql_ queries just not working!

Post by Jim_UK » Sun Mar 16, 2008 6:08 pm

I have helped by moving it to a more appropriate forum. There is no support for mods of any kind in the previous forum.
In this the Mod Writers Discussion forum you stand the best chance of some help.

Good luck

Jim
The truth is out there.
Unfortunately they will not let you anywhere near it!

taifunbrowser
Registered User
Posts: 60
Joined: Sun Sep 10, 2006 2:09 am
Contact:

Re: $db->sql_ queries just not working!

Post by taifunbrowser » Sun Mar 16, 2008 6:27 pm

ah! after hunting for some more code, I found this:

$db->sql_error($result)

and it told me what my problem was. These sort of things should be in bolder print <_<

problem: I had 2 timestamps both with "defult" update-on-update behavior, I still don't really know how to work with datetimes vs timestamps, but I'll figure that out later: it works now XD

*topic solved by poster*

Post Reply

Return to “[2.0.x] MOD Writers Discussion”