| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8
Comments:
<0> statement = connection.createStatement(); <0> rs = statement.executeQuery("SELECT * FROM mytable"); <0> while (rs.next()) { <0> out.println(rs.getString("myfield")+"<br>"); <0> } <0> rs.close(); <0> sorry for flooding <1> you should be very sorry <0> i got that just for retrieving data from the database.. <0> oops <0> dun kick me <2> okay, how does this look? $result = MYSQL_QUERY("insert into contributors_0a (name_id) values ('".$name_id."'),('".$name."'),('".$email."'),('".$bio."'),('".$projects."'),('".$screen_image."'),('".$external_link."'),('".$email_turnover."'),('".$sketch_turnover."')"); <1> Phineas: http://no.php.net/manual/en/function.mysqli-stmt-prepare.php <0> sorryy <1> Phineas: ? <1> Phineas: that didn't really make any sense
<2> K_F ...what about it doesn't makes sense...? I followed the example you posted of INSERT INTO table(a) VALUES(1,'a'),(2,'b'); <1> that would be to insert multiple name_id's at once <2> ohhhhhhhhhhhhh <1> I have absolutely no idea now what you're attempting to do <1> trying to re-read your question <2> damn... well, i just have this forum with mulitple values i want to put in a table <2> multiple colums <1> simple SQL; try http://www.kfwebs.net/links/6 for SQL <1> introduction to sql for beginners <1> iirc there is a chapter on INSERT <2> do i have to repeat this line every time then for each variable? $result = MYSQL_QUERY("insert into contributors_0a (name_id) values ('".$name_id."')"); <1> but you want an INSERT INTO table(field1,field2),.............) VALUES('a','b',....); <1> see, that is the part that doesn't make sense <1> and why you probably should read a guide on SQL.. <1> at least learn how to ask proper questions, hopefully you see how that can be read as multiple name_id's <0> ahh K_F masta.. how bout mine? how can i insert data into the database? <2> i'm on this page... i don't see anything about "iirc" or "insert" <2> (on http://www.kfwebs.net/links/?cID=6) <2> i even did a "find on page" for the string "insert"... ? <1> rofl <1> iirc is an abbreviation for "if I recall correctly" <1> "<1> introduction to sql for beginners" <2> oh okay <1> okay, it was on page 2 <1> http://www.kfwebs.net/links/?cID=6&page=2 <1> http://sqlcourse.com/insert.html <2> ah, thanks <1> omi`: http://sqlcourse.com/insert.html <2> when it says Note: All strings should be enclosed between single quotes: 'string' - does that mean that apostrophies are called "single quotes"? <1> ' <- single quote <1> " <- double quote <1> ` <- tickback <2> hm, that's interesting... the character ' has nothing to do with quotes in normal english... people just expect you to know this **** <1> jup <0> K_F so u mean u just need to change the line rs = statement.executeQuery("SELECT * FROM mytable"); into and insert statement? <1> not really <1> for one thing it doesn't return a recordset <1> Phineas: but it is a quotation mark <0> whats a record set? <1> => quote character <1> omi`: what do you think "rs" is? <1> really speedy? <1> s/rs\s=\s// <1> and it should be ok <0> wha? <1> just, uhm, read about it <0> ok ok wait <2> okay, it from this page it would apear my ('".$name_id."') has a lot of redundent stuff... the period on either side, the $ the "double" quotes... do you think i can just get rid of them and have it like ('name_id')? <1> been a long time since I helped someone that didn't understand a simple perl replace <1> Phineas: that isn't redundant <1> but you're using PHP aren't you? <2> yes, i am (if you're talking to me) <1> all PHP variables are named $varname <2> well the document you sent me to doesn't have all that <1> because it is generic? <1> doesn't use any variables at all.. <1> of course you can write a SQL query by hand, but if you use PHP you insert PHP variables <2> ok <2> okay, i think this is right: <2> $result = MYSQL_QUERY("insert into contributors_0a (name_id),(name),(email),(bio),(projects),(screen_image),(external_link),(email_turnover),(sketch_turnover) values ('".$name_id."'),('".$name."'),('".$email."'),('".$bio."'),('".$projects."'),('".$screen_image."'),('".$external_link."'),('".$email_turnover."'),('".$sketch_turnover."')");
<2> i'll test it now :) <3> :O :)) <0> K_F MAN THANKS FOR YOUR HELP] <1> omi`: uhm, ok <2> okay, it returned this error, You have an error in your SQL syntax near '(name),(email),(bio),(projects),(screen_image),(external_link),(email_turnover),' at line 1 <2> any idea why...? <2> it's formatted as it is in the example <1> yes <1> <1> but you want an INSERT INTO table(field1,field2),.............) VALUES('a','b',....); <1> and no it isn't <1> uhm, there is an error in the example <2> there is? <1> s/field2\)/field2/ <1> INSERT INTO table(col1,col2) VALUES('adsdas','asddsa'); <1> yeah, first I was about to write just that, but added the .............. thing <4> how do I select records from mysql that their length is less then 10 chars? <1> Paki\: http://www.kfwebs.net/links/6 for SQL <1> look into CHAR_LENGTH() <2> so what you're saying, K_F, is that instead of putting () around each field name and each variable, I should just put () around all of them in each case? <1> you use () to mark the tuplets <1> if a tuplet consist of say two values it is (val1,val2) <2> you used that word before, i just ***umed it was a typo of "tabe" - wtf does tuplet mean? <2> "table"* <1> In {functional language}s, a data object containing two or <1> more components. <1> definition of "tuple" <1> Also known as a product type or pair, <1> triple, quad, etc. Tuples of different sizes have different <1> types, in contrast to lists where the type is independent of <1> the length. <2> ok, thanks <2> i can't belive this is working... thanks for your help <2> can you suggest a good tutorial / example for retreiving the variables? <1> hehe <1> depends on your definition of retrieving the variables <1> PHP side? <1> or SQL side+ <1> ? <2> php <1> getting it from a form then? <2> like... i just want to insert them into html, using php <1> ah <1> so SELECT on the SQL side <1> http://www.kfwebs.net/links/6 for SQL <2> well, the form is one page, the page i'll be displaying them on, after they're in the database, will be another <1> php.net/mysql_query <1> lets see, I have some listed on http://www.kfwebs.net/links/5 for PHP <1> try PHP Beginner <1> it should have some tutorials on the subject <1> Example 2. Valid Query <- on php.net/mysql_query <2> well, it seems to do something... http://www.clovenhand.com/query_test.php <2> i think the error is here? for($i=0;$i<mysql_num_rows($result_cols);$i++) <2> like, maybe it keeps going through the for loop until it hits the 10th column that doesn't exist? <1> that doesn't make sense <1> while($field = mysql_fetch-array($result)){echo $field['colname'];} <1> anyways, basic PPHP <1> PHP* <1> while($field = mysql_fetch_array($result)){echo $field['colname'];} <1> arrgh <2> well, obviously i am very much a newbie to PHP--but I'm not using the PHP channel because what I'm doing is more along the lines of a MYSQL help channel ;) wouldn't you agree? <1> no <1> but you would be thrown head first out of #php .. <1> kick message saying something like, "RTFM" <2> lol <1> must be that I'm in a good mood to have the data restored from the malfunctioning HDD <2> you're funny... split personality ;) <2> ah, congrats <2> well, i replaced my for statment with your while and then it didn't do anything, so I put the for back... at least now it shows the last row in the table http://www.clovenhand.com/query_test.php <2> it says line 46 is the problem: mysql_data_seek($result_all, $this_row); <1> hmm <5> hi
Return to
#mysql or Go to some related
logs:
loolitaa sex #AllNiteCafe ping dendmsg operation not permited apache2 mod_includes issues nenasas #linux sexytrans pics #linux #mirc CCNA test 6*7
|
|