Forum Moderators: coopster

Message Too Old, No Replies

Viewing all text in field

         

Amy Ra Ra Ra

2:28 am on Apr 20, 2012 (gmt 0)

10+ Year Member



Can anyone tell me how I can view all of the text in a certain column and row? If you don't mind wtire up something fake for me please.

cffrost2

2:49 am on Apr 20, 2012 (gmt 0)

10+ Year Member



Hi. Are you just looking to query a db and return a result set/row and view the column data?

I noticed in your other post you're using mysqli. Is this true or are you using mysql?

Amy Ra Ra Ra

3:01 am on Apr 20, 2012 (gmt 0)

10+ Year Member



ahh, I'm so new to all of this. I think that I'm using mysql because when I tried to use mysqli_connect I got an error. I do know that it's version 5.0.

I am able to use the terminal and write a query that shows a short list of the certain row but it doesn't show me all of the text. It only shows me the text as if it were written in the original form. I hope that you understand what I'm talking about? I was going to take a capture of it and attach it but I see that there's no option for attaching files.

cffrost2

3:13 am on Apr 20, 2012 (gmt 0)

10+ Year Member



So do you need a query for the terminal(phpmyadmin?) or do you need a php script? Take you time to learn it. Once you get the basics, things will start to clear up. :)

rocknbil

4:12 pm on Apr 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're not going to do anything until you get past the connect error. What is the error, and are you **sure** you should be using mysqli, and not just mysql? They are different (see PHP manual.)

Do something like this before going further. It's the foundation of everything from here out. This is not copy and paste code and may contain errors, but you can see what it does - connects to the DB, selects a table, and outputs the contents of the table.


<?php
$host = 'localhost'; // OR mysql.yoursite.com - it varies
$usr = 'my_database_user';
$pas = 'mY$3CUreP@s$w0rD';
$db = 'the_database_name';
//
$link = mysqli_connect($host, $usr, $pas, $db);
//
if (!$link) {
echo"Connect failed: " . mysqli_connect_error();
exit();
}
else {
// Do a test selection
$query = "select * from `some_table_in_database`";
if ($result = mysqli_query($link, $query)) {
while ($row = mysqli_fetch_array($result)) {
$cols = count($row);
echo '<p>';
for ($i=0;$i<=$cols;$i++) {
echo ' ' . $row[$i] . ' ';
}
echo '</p>';
}
}
else { echo "Could not test database: " . mysqli_error(); }
}
?>


Once you get past that, everything will become clear as to why you can't get connected.