Jump to content

Database with php and without mysql?


eduard

Recommended Posts

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 :Pleased:

Link to comment
Share on other sites

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

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

$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

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

$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

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?
:lol: OK, that was funny.
Link to comment
Share on other sites

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. :lol: OK, that was funny.
No, it wasn´t funny! I´m very serious!
Link to comment
Share on other sites

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. :lol: 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

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. :lol: 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

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

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

P. s. Ingolme: very good suggestion: php tutorial written in Dutch!
Dutch? I thought your native language was Spanish. :blink:
Link to comment
Share on other sites

Dutch? I thought your native language was Spanish. :blink:
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 by eduardlid
Link to comment
Share on other sites

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.
  • Like 1
Link to comment
Share on other sites

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...