first script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



adapted from php/mysql for dummies, I'd like it to return the "notes" field,
too, pls.  I know that I want to echo "notes", but can't figure out where to do
so.  any pointers would be appreciated :)

[thufir@localhost ~]$ 
[thufir@localhost ~]$ 
[thufir@localhost ~]$ cat /var/www/html/showapts.php
<html>
<head><title>apts</title></head>
<body>
<?php
  $user="root";
  $host="localhost";
  $password="password";
  $database = "apts";

  $connection = mysql_connect($host,$user,$password)
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");
  $query = "SELECT DISTINCT * FROM craigslist ORDER BY id";
  $result = mysql_query($query)
       or die ("Couldn't execute query.");

  /* create form containing selection list */
  echo "<form action='processform.php' method='post'>
        <select name='id'>\n";

  while ($row = mysql_fetch_array($result))
  {
     extract($row);
     echo "<option value='$id'>$id\n";
  }
  echo "</select>\n";
  echo "<input type='submit' value='id'>
        </form>\n";
?>
</body>
</html>
[thufir@localhost ~]$ 
[thufir@localhost ~]$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 98 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| apts               | 
| mysql              | 
| test               | 
+--------------------+
4 rows in set (0.00 sec)

mysql> use apts;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+----------------+
| Tables_in_apts |
+----------------+
| craigslist     | 
+----------------+
1 row in set (0.00 sec)

mysql> describe craigslist;
+-------+---------------------+------+-----+---------+-------+
| Field | Type                | Null | Key | Default | Extra |
+-------+---------------------+------+-----+---------+-------+
| notes | longtext            | NO   |     |         |       | 
| id    | bigint(15) unsigned | NO   |     |         |       | 
+-------+---------------------+------+-----+---------+-------+
2 rows in set (0.01 sec)

mysql> quit
Bye
[thufir@localhost ~]$ 
[thufir@localhost ~]$ date
Fri Apr 20 19:40:29 BST 2007
[thufir@localhost ~]$ 
[thufir@localhost ~]$ 



thanks,

Thufir

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux