Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
Jamroom Developers:
Need help with dbQuery when inserting.
promotedenver



Joined: 05 Sep 2006
Posts: 141

Posted: 08/03/09 18:16 
Whats wrong with this?

dbQuery(dbEscapeString("INSERT INTO jamroom_calendar VALUES('146', '1249334217', '1249341300', '0', '5-0 cent bowling', 'My house Testing only. sorry but soon you can have them.', 'yes', 'yes', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1:00am', '11:00pm', 'Mon')"));

i did not include the auto inc event_id in the query.

Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 08/03/09 18:50 
You haven't told it what fields you are entering:

http://dev.mysql.com/doc/refman/5.1/en/insert.html


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
promotedenver



Joined: 05 Sep 2006
Posts: 141

Posted: 08/03/09 19:05 

smith.kyle:
You haven't told it what fields you are entering:

http://dev.mysql.com/doc/refman/5.1/en/insert.html


doh, I got it now thnx.

Back to top
promotedenver



Joined: 05 Sep 2006
Posts: 141

Posted: 08/04/09 20:03 
So i got it to work with a simple example. Can anyone point out what i'm missing here please. I created a new table for this. Now rows are added using this query.


Code
dbQuery(dbEscapeString("INSERT INTO jamroom_hh (owner, title, day_of_week, time_start, time_end, food, booze, patio, underage, pool, live, karaoke) VALUES(27,".$_POST['title'].",".$_POST['day_of_week'].",".$_POST['time_start'].",".$_POST['time_end'].",".$_POST['food'].",".$_POST['booze'].",".$_POST['patio'].",".$_POST['underage'].",".$_POST['wifi'].",".$_POST['pool'].",".$_POST['live'].",".$_POST['karaoke'].")"));


Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 08/04/09 20:47 
That's not quite how you would want to do it. Check out the dbQuery's in the module developer's guide and see how they're done in there:

http://www.jamroom.net/Module_Developer_Guide


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
promotedenver



Joined: 05 Sep 2006
Posts: 141

Posted: 08/04/09 21:19 
comparing guide example still not working:

Code
$req = "INSERT INTO table (value_1,value_2)   
VALUES ('". dbEscapeString($_post['value_1']) ."','". dbEscapeString($_post['value_2']) ."')";



Code
    dbQuery("INSERT INTO jamroom_hh (owner, title, day_of_week, time_start, time_end, food, booze, patio, underage, pool, live, karaoke)
   VALUES('27','".dbEscapeString($_POST['title'])."','".dbEscapeString($_POST['day_of_week'])."','".dbEscapeString($_POST['time_start'])
   ."','".dbEscapeString($_POST['time_end'])."','".dbEscapeString($_POST['food'])."','".dbEscapeString($_POST['booze'])
   ."','".dbEscapeString($_POST['patio'])."','".dbEscapeString($_POST['underage'])."','".dbEscapeString($_POST['wifi'])."')");


Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 08/05/09 11:18 
What error does dbQuery give you? Is owner an auto_increment primary key? If so, you'll wan to to leave it out.


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
promotedenver



Joined: 05 Sep 2006
Posts: 141

Posted: 08/05/09 11:39 

smith.kyle:
What error does dbQuery give you? Is owner an auto_increment primary key? If so, you'll wan to to leave it out.


id is the primary AI col.

I get no error whatsoever.

Back to top
promotedenver



Joined: 05 Sep 2006
Posts: 141

Posted: 08/05/09 11:43 

promotedenver:

smith.kyle:
What error does dbQuery give you? Is owner an auto_increment primary key? If so, you'll wan to to leave it out.


id is the primary AI col.

I get no error whatsoever.


Oops, something didnt get pasted into the query. Nvm my bad i was missing two fields. How come i didnt see any errors though?
Thanks for your help,
Nick

Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 08/05/09 11:49 
dbQuery won't echo anything - it will return some value. If you want to see what's returned, I'd use Jamroom's debug() function:

$_rt = dbQuery(etc.etc....
debug($_rt,000);


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
Jamroom Developers

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.