divinedesigns1 Posted April 22, 2012 Share Posted April 22, 2012 also the <tr> tags are part of a table <table><tr><td></td></tr></table> i hope you understand everything clearly now i like W3S Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 I know now: It´s not a closing error anymore!It´s in the while, for each loop!It´s not ´n´Let´s find it! Link to comment Share on other sites More sharing options...
boen_robot Posted April 22, 2012 Share Posted April 22, 2012 if (!mysql_select_db('website')die("Can't select database"); You're missing a ")" for the condition of "if". Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 What the f... is while ($property = mysql_fetch_field($result)) property? Link to comment Share on other sites More sharing options...
boen_robot Posted April 22, 2012 Share Posted April 22, 2012 $property is just the name of the variable that holds the result of mysql_fetch_field(). The result of mysql_fetch_field() is an object (as you can see in mysql_fetch_field's manual page), but that doesn't prevent you from calling the variable something completely different and unrelated. Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 The tutorials aren´t too dificult to me; it´s the way to write write things correct that causes problems!Suggestions please? Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 $property is just the name of the variable that holds the result of mysql_fetch_field(). The result of mysql_fetch_field() is an object (as you can see in mysql_fetch_field's manual page), but that doesn't prevent you from calling the variable something completely different and unrelated. I thought so! But why in this example is used this as a name, why not all the world (like me!) speak perfectly english? Link to comment Share on other sites More sharing options...
boen_robot Posted April 22, 2012 Share Posted April 22, 2012 The tutorials aren´t too dificult to me; it´s the way to write write things correct that causes problems!Suggestions please?Write things one by one. Don't move on until you get something working correctly. Stop getting ahead of yourself.I thought so! But why in this example is used this as a name,Perhaps the person who originally wrote this didn't know better... where did you find this example anyway? The code you show above uses $field as a name instead.why not all the world (like me!) speak perfectly english? OK, that was funny. Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 Write things one by one. Don't move on until you get something working correctly. Stop getting ahead of yourself. Perhaps the person who originally wrote this didn't know better... where did you find this example anyway? The code you show above uses $field as a name instead. OK, that was funny. No, it wasn´t funny! I´m very serious! Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 Write things one by one. Don't move on until you get something working correctly. Stop getting ahead of yourself. Perhaps the person who originally wrote this didn't know better... where did you find this example anyway? The code you show above uses $field as a name instead. OK, that was funny. Here I found the example: http://www.anyexample.com/programming/php/php_mysql_example__display_table_as_html.xml Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 Write things one by one. Don't move on until you get something working correctly. Stop getting ahead of yourself. Perhaps the person who originally wrote this didn't know better... where did you find this example anyway? The code you show above uses $field as a name instead. OK, that was funny. Your suggestion is very good! Unfortunately, I haven´t the space and the quietness here in this f.... hostel to work like this! Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 This is too difficult to me! Where do I start? Link to comment Share on other sites More sharing options...
divinedesigns1 Posted April 22, 2012 Share Posted April 22, 2012 i would suggest learning the basic of html, css and php then move on from there, youtube have a lot fo videos base on these languages and their basic, also right here on W3S Link to comment Share on other sites More sharing options...
Ingolme Posted April 22, 2012 Share Posted April 22, 2012 I suggest trying to find tutorials in your main language. Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 FINALLY, (WITH HELP OF AN IMPATIENT ARGENTINIAN PROGRAMMER!): <html><head><title>MySQL Table Viewer</title></head><body><?php$db_host = 'localhost';$db_user = 'root';$db_pwd = 'usbw';$database = 'website';$table = 'links';if (!mysql_connect($db_host, $db_user, $db_pwd)) { die("Can't connect to database"); }if (!mysql_select_db('website')) { die("Can't select database"); }// sending query$result = mysql_query("SELECT * FROM ($table)");if (!$result) { die("Query to show fields from table failed");}$fields_num = mysql_num_fields($result);echo "<h1>Table: {$table}</h1>";echo "<table border='1'><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td>{$field->name}</td>"; } echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n"; } mysql_free_result($result); ?></body></html> P. s. Ingolme: very good suggestion: php tutorial written in Dutch! Link to comment Share on other sites More sharing options...
boen_robot Posted April 22, 2012 Share Posted April 22, 2012 P. s. Ingolme: very good suggestion: php tutorial written in Dutch!Dutch? I thought your native language was Spanish. Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 (edited) Dutch? I thought your native language was Spanish. I´m a dutchman living in Argentina now! (past 3 years in Chile!) There isn´t a php tutorial in Dutch (I´m not going to write it!), so I´ve to take the english version with Google translator! Edited April 22, 2012 by eduardlid Link to comment Share on other sites More sharing options...
eduard Posted April 22, 2012 Author Share Posted April 22, 2012 Finally, I found a php tutorial which makes it easier for me to understand php: http://www.1keydata.com/php-tutorial/ Link to comment Share on other sites More sharing options...
elexion Posted April 23, 2012 Share Posted April 23, 2012 I´m a dutchman living in Argentina now! (past 3 years in Chile!) There isn´t a php tutorial in Dutch (I´m not going to write it!), so I´ve to take the english version with Google translator! that's bull, there are plenty of Dutch PHP tutorials your just not looking. 1 Link to comment Share on other sites More sharing options...
dsonesuk Posted April 23, 2012 Share Posted April 23, 2012 The problem isn't the language problem as the code will be the same, its how you add the code you are always missing quotes(single or double) brackets etc unless you remember this and type the code correctly! it will cause it to break whatever language you read it in. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted April 23, 2012 Share Posted April 23, 2012 The problem isn't the language problem as the code will be the same, its how you add the code you are always missing quotes(single or double) brackets etc unless you remember this and type the code correctly! it will cause it to break whatever language you read it in.thats so true, i did that yesterday and the code stop working hehehehehe Link to comment Share on other sites More sharing options...
eduard Posted April 23, 2012 Author Share Posted April 23, 2012 that's bull, there are plenty of Dutch PHP tutorials your just not looking. Oh yes, tell me where: Dutch PHP CONFERENCE are there many! Link to comment Share on other sites More sharing options...
eduard Posted April 23, 2012 Author Share Posted April 23, 2012 The problem isn't the language problem as the code will be the same, its how you add the code you are always missing quotes(single or double) brackets etc unless you remember this and type the code correctly! it will cause it to break whatever language you read it in. PHP language is standard (english). but it makes it far more easier to know when you need (), {}, [] in your native language! Link to comment Share on other sites More sharing options...
dsonesuk Posted April 23, 2012 Share Posted April 23, 2012 NO! it makes it far easier when you close ',", (, [, { in whatever native language. Link to comment Share on other sites More sharing options...
eduard Posted April 23, 2012 Author Share Posted April 23, 2012 Closing (just a sign!) isn´t difficult! Knowing what you must is! (at least for me!) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now