Jump to content

Database with php and without mysql?


eduard
 Share

Recommended Posts

Is there a possibility to show an image of a database on the homepage of my website, creating a link from thst imsge to a working database in my portfolio without using phpmyadmin? Can I use MySQL or instead of using php I have to learn another programming language?

Link to comment
Share on other sites

what do you mean by image of database? there is no such thing image of database. only way to show a working database is developing a working application.

Edited by birbal
Link to comment
Share on other sites

what do you mean by image of database? there is no such thing image of database. only way to show a working database is developing a working application.
I´m sorry, but have you read my question carefully? (I don´t think so: IMAGE OF DATABASE ON HOMEPAGE (E. G. GOOGLE)!, WORKING DATABASE IN PORTFOLIO!
Link to comment
Share on other sites

you might need to explain yourself clearly so we can understand you properly,phpmyadmin is MYSQLif you wish to show your database you would have to make a link to that page " the phpmyadmin page url". but if you just would like to show an image, just take a few screen shots of your database by hitting "PrtSCSysRq" on your keyboard then opening adobe photoshop or paint or w.e you use to do your graphic work and hit "ctrl+v" to paste it then you crop it according to how you want it to be show or what you want to be shown. :Pleased: if that isnt what you want, kindly explain a little better so we can help you "WE TAKE OUT TIME FROM WHAT WE ARE DOING TO HELP YOU" so please cut the attitude, have a nice day/night :)

Link to comment
Share on other sites

you might need to explain yourself clearly so we can understand you properly,phpmyadmin is MYSQLif you wish to show your database you would have to make a link to that page " the phpmyadmin page url". but if you just would like to show an image, just take a few screen shots of your database by hitting "PrtSCSysRq" on your keyboard then opening adobe photoshop or paint or w.e you use to do your graphic work and hit "ctrl+v" to paste it then you crop it according to how you want it to be show or what you want to be shown. :Pleased: if that isnt what you want, kindly explain a little better so we can help you "WE TAKE OUT TIME FROM WHAT WE ARE DOING TO HELP YOU" so please cut the attitude, have a nice day/night :)
Pffffffffff! Same reply as previous! WITH PHP. WITHOUT MYSQL REPLY: YES OR NO PLEASE! Edited by eduardlid
Link to comment
Share on other sites

Alright! YES and NO, depending on what the ###### you are talking about, that's what trying to figure out?

Is there a possibility to show an image of a database on the homepage of my website
Image of database can only be a print screen of mysql console, or phpmyadmin showing databases, tables so yes! thats possible, and yes! it can be shown on your website
, creating a link from thst imsge to a working database in my portfolio without using phpmyadmin?

Yes! you can create a link from image, but NO! it won't be to a working database as it will link to a PHP application that will interact with a mysql database. definite a YES! as you wouldn't use phpmyadmin to create a link?? you would use html anchor link and also you would never enable anyone to access phpmyadmin through ANY page unless you enjoy having hackers reek havoc on your website. You can also use text file to store data, meaning yes! you can do without mysql and phpmyadmin, but you have to know how to read and write to a text file using php, WITHOUT any interface such as phpmyadmin to make it easy.

Edited by dsonesuk
Link to comment
Share on other sites

Alright! YES and NO, depending on what the ###### you are talking about, that's what trying to figure out? Image of database can only be a print screen of mysql console, or phpmyadmin showing databases, tables so yes! thats possible, and yes! it can be shown on your website
, creating a link from thst imsge to a working database in my portfolio without using phpmyadmin?

Yes! you can create a link from image, but NO! it won't be to a working database as it will link to a PHP application that will interact with a mysql database. definite a YES! as you wouldn't use phpmyadmin to create a link?? you would use html anchor link and also you would never enable anyone to access phpmyadmin through ANY page unless you enjoy having hackers reek havoc on your website. You can also use text file to store data, meaning yes! you can do without mysql and phpmyadmin, but you have to know how to read and write to a text file using php, WITHOUT any interface such as phpmyadmin to make it easy.

Thanks very much, prof!Wat about this code (stiill errors!) <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 linksif (!$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($k as $m) echo "<td>$cell</td>"; echo "</tr>\n"; } mysql_free_result($result); ?></body></html> I assume the errors are here: $fields_num = mysql_num_fields($result);, but I don´t understand them! This is the echo: Table: {$table}"; echo ""; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo ""; } echo "\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo ""; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($k as $m) echo ""; echo "\n"; } mysql_free_result($result); ?> {$field->name} $cell Edited by eduardlid
Link to comment
Share on other sites

NO! the problem is here $result = mysql_query("SELECT * FROM links AS it is not properly closed, so the code after IT is taken as being part of it, that is why when it point to an error at $fields_num = mysql_num_fields($result); it usually means the code before it as in // sending query$result = mysql_query("SELECT * FROM linksif (!$result) {die("Query to show fields from table failed");} with the unclosed SQL query statement mentioned. the other errors are here

foreach($k as $m)echo "<td>$cell</td>";

OK! $m is treated AS $k, but! what the h-e-l-l is $k in the first place, and after that what the h-e-l-l is $cell a reference to? if you can't provide the answers, its definitely is not going to, but it must be giving these values to function properly, else surprise, surprise it will fail.

Edited by dsonesuk
Link to comment
Share on other sites

NO! the problem is here $result = mysql_query("SELECT * FROM links AS it is not properly closed, so the code after IT is taken as being part of it, that is why when it point to an error at $fields_num = mysql_num_fields($result); it usually means the code before it as in // sending query$result = mysql_query("SELECT * FROM linksif (!$result) {die("Query to show fields from table failed");} with the unclosed SQL query statement mentioned.
But if I close it; I get also an error! $result = mysql query("SELECT * FROM links)
Link to comment
Share on other sites

LOOK! LOOK! LOOK! COMPARE THE OPENING TO THE CLOSING SEEEEEEEEEE THE DIFFERENCE OPEN YOUR EYES.
That´s the s..... I don´t see the difference (especially when it´s dark) between ) and } good! Thanks anyway!So could you explain clearly to me please when you get (, { and [? Edited by eduardlid
Link to comment
Share on other sites

NO! the problem is here $result = mysql_query("SELECT * FROM links AS it is not properly closed, so the code after IT is taken as being part of it, that is why when it point to an error at $fields_num = mysql_num_fields($result); it usually means the code before it as in // sending query$result = mysql_query("SELECT * FROM linksif (!$result) {die("Query to show fields from table failed");} with the unclosed SQL query statement mentioned. the other errors are here
foreach($k as $m)echo "<td>$cell</td>";

OK! $m is treated AS $k, but! what the h-e-l-l is $k in the first place, and after that what the h-e-l-l is $cell a reference to? if you can't provide the answers, its definitely is not going to, but it must be giving these values to function properly, else surprise, surprise it will fail.

k= a value for a column ´Site_Name´ $cell I don ´t know (copy & paste!)!
Link to comment
Share on other sites

?????????? its was nothing to do with ), { or ] look! i am not telling where the problem is, as its in plain sight!
Sorry, I´lll find that f... error!
Link to comment
Share on other sites

This is why you should not copy and paste code into another unless you first understand the code, and how to integrate into existing code as No! $k is not a reference to column 'Site_Name' it reference all columns to retrieve each value from each row using a foreach loop. So it should be reference to the while loop variable which loops through ALL THE COLUMN values, and $cell should be the AS variable within the foreach loop.

Link to comment
Share on other sites

Your answers are still too difficult for me!This I got so far: <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->Site_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. I´m going to re-read your reply!In which php tutorial do I find the answer?

Edited by eduardlid
Link to comment
Share on other sites

Is the answer in php while loops?
yu need to add another ")" on line 11 that should fix your stuff, not saying where tho thats pretty close and you should see, it it only took me a short time to notice it *if you open anything you have to close it*
Link to comment
Share on other sites

Well since i mentioned while, foreach loops, and variables within them! seriously, what do you think, i put them in there for decoration. AND why! have you changed echo "<td>{$field->Site_Name}</td>"; ??? read and understand http://www.w3schools...fetch_field.asp
I´ll!
Link to comment
Share on other sites

But if I close it; I get also an error! $result = mysql query("SELECT * FROM links)
LOOK! LOOK! LOOK! COMPARE THE OPENING TO THE CLOSING SEEEEEEEEEE THE DIFFERENCE OPEN YOUR EYES.
*if you open anything you have to close it*
In case you still haven't figured out this error, here's another hint:In PHP, strings are opened with the character
"

or the character

'

and are closed with the same character that opened the string.NOW, have another look at

$result = mysql query("SELECT * FROM links)

and tell me where the error is.

Link to comment
Share on other sites

I don´t understand the ´n"´in this code (while .....) <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->$Site_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>

Link to comment
Share on other sites

You mean

echo "</tr>\n";

?Everything between the two

"

is echoed. Those form a "double quoted" PHP string. Within a double quoted PHP string, the

\n

means a "new line" character.=> The echo echoes a closing "tr" tag, and a "new line" character.The "new line" character is not visible on screen, but can be seen if you right click on the generated web page, and then click "View Source".

Link to comment
Share on other sites

You mean
echo "</tr>\n";

? Everything between the two

"

is echoed. Those form a "double quoted" PHP string. Within a double quoted PHP string, the

\n

means a "new line" character. => The echo echoes a closing "tr" tag, and a "new line" character. The "new line" character is not visible on screen, but can be seen if you right click on the generated web page, and then click "View Source".

boen your too fast with your reply hehehehe i wrote like 2 words and i got a pop up "a new reply" hehehe but thats a good explaination tho ill write that down :)
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
 Share

×
×
  • Create New...