vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Query Help - Just a question about writing a query... (https://vborg.vbsupport.ru/showthread.php?t=50033)

Rose 03-12-2003 04:03 PM

Query Help - Just a question about writing a query...
 
I'm praciticing some queries and I have a couple questions. First, let me explain my practice queries -

I figured I'd just write a bunch of "INSERT INTO"'s for different calendar events (general holiday stuff).

[sql]
INSERT INTO calendar_events (eventid, userid, event, eventdate, public, subject, allowsmilies) VALUES (4, 1, 'Thanksgiving - US.\r\n\r\n\r\n', '2003-11-27', 1, 'Thanksgiving', 1);
[/sql]


My question is this - Must I set the eventid, or is there a way to have it automatically set itself. Reason being - I have events already added to the calendar and I just wondered if I needed to consecutively add all the eventid's appropriately or if it could do it magically itself.

Xenon 03-12-2003 04:24 PM

look into the field properties, if the field has the autoincrement enabled you can just set NULL as id and it'll use the highest free id ;)

Rose 03-12-2003 04:32 PM

Quote:

Originally posted by Xenon
look into the field properties, if the field has the autoincrement enabled you can just set NULL as id and it'll use the highest free id ;)

I believe it has autoincrement enabled for the eventid. Yes.

*test*

Sweeet! Thanks, Xenon. It worked like a charm.

[high]* Rose takes note in lil' fat cheatsheet book and chalks another learning point up
[/high]

*hehe*

Serge 03-13-2003 01:11 AM

Ok just another question that would build on this one. When I wanted to query for that information to echo it out for whatever and I set up a query somewhat like this:

PHP Code:

$results mysql_query("select * from table"

Also if I didn't want everything would I just take out the star and insert the fields I wanted. And what would be the sentax if I only wanted say the username and password from the table.

Sorry for the all questions I'm just very interested. :)

mr e 03-13-2003 02:14 AM

PHP Code:

$results mysql_query("SELECT username, password FROM table"); 

btw, whats up with the quote boxes?


All times are GMT. The time now is 06:26 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00933 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete