hi

thanks for the info. before i recieved your email i managed o cobble 
somethign together from some tutorials. this is the code i am using

<?php

$host="localhost";
$username="gecko_gecko";
$password="3t7b8011";
$database="gecko_content";
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$result = mysql_query("SELECT * FROM portfolio ORDER BY header ASC") or 
die(mysql_error());

while($row = mysql_fetch_array( $result )) {
print ("<h1>{$row['header']}</h1><hr>");
print ("<p>{$row['body']}</p>");
}
?>

unfortunately, i have to have this code on each page and change the 
table name for each one. i have looked at your code and i am not sure i 
fully understand it. will this allow me to have one page with all the 
php in, and depending on what link is clicked, will it then show that 
information?

i have a database called "content" with 40 tables, each named after the 
a section of the site. (probably not the best layout, but i am learning)

i have the input page all figured out, and now im working on the edit 
and update pages.

thanks.

mark m...







Michael Sullivan wrote:
> On Tue, 2006-03-21 at 04:45 +0000, Mark Mckee wrote:
> 
>>hi all
>>
>>I am definately stuck now. i have managed to insert data into my
>>table 
>>using php and sql staements.
>>
>>I have also managed to display that data on a single page.
>>
>>the points where i am stuck
>>
>>1) how do i display all the data contained in the table and not just
>>the 
>>  one row?
>>
> 
> 
> To answer this question, here's an excerpt from my current project:
> 
> if ($fullname == "Choir")
>    $result = mysql_query("SELECT entry_name FROM ChoirEntry WHERE
> school_id='$schoolid' ORDER BY entry_name ASC;") or die("Could not find
> record.");
> else
>    $result = mysql_query("SELECT entry_name FROM BandEntry WHERE
> school_id='$schoolid' ORDER BY entry_name ASC;") or die("Could not find
> record.");
> 
> 
> if (mysql_num_rows($result) > 0)
> {
>    while($a_row = mysql_fetch_array($result, MYSQL_ASSOC))
>    {
>       foreach($a_row as $field)
>       {
>          print "<tr><td align='center'>$field</td></tr>\n";
>       }
>    }
> }
> else
> {
>    print "<tr><td align='center'>None Entered Yet</td></tr>";
> }
> 
> 
> As you can see, I use a while loop to iterate through the results using
> mysql_fetch_array.
> 
> 
>>2) i have my input form up and ready. a place for the header, test and
>>a 
>>drop down box containing the 40 pages i want to choose from to
>>update. 
>>how do i send the correct header text and the chioce in the drop down
>>to 
>>  the correct table?
> 
> 
> <form method='post' action='nextpage.php'>
> <select name='choices'>
> <option>Option1</option>
> <option>Option2></option>
> <input type='submit' value='Send Choice">
> 
> On nextpage.php have a line near the top of the script that says:
> $someVar = $_POST['choices'];
> 
>>i think thats it for now lol. any help would be grately appreciated
>>
>>kind regards
>>
>>Mark...
>>
>>
>>
>>
>>Mark Mckee wrote:
>>
>>>thank you for the help.
>>>
>>>i wil keep trying to get it working.
>>>
>>>Michael Sullivan wrote:
>>>
>>>
>>>>On Tue, 2006-03-21 at 00:52 +0000, Mark Mckee wrote:
>>>>
>>>>
>>>>
>>>>>hi all
>>>>>
>>>>>i want to create an inut page for the content on my website. is it 
>>>>>possible to have 1 data entry box and choose the specific what
>>
>>table
>>
>>>>>of 
>>>>>a database to put it usign a drop down box?
>>>>>
>>>>>if so, can someone please point me in the right direction. i have
>>>>>been 
>>>>>troubling over this for the last few days
>>>>>
>>>>>thanks in adavce
>>>>>
>>>>>mark m...
>>>>
>>>>
>>>>I don't see why this wouldn't be possible.  You would just use the
>>
>>table
>>
>>>>name selected from the list box in constructing the query string you
>>
>>use
>>
>>>>in your mysql_query.
>>>>
>>>>Ex.
>>>>
>>>>I select 'SomeTable' from a list box called 'list' and hit the
>>
>>Submit
>>
>>>>button.  Another page is called, in which is a line like this:
>>>>
>>>>$list = $_POST['list'];
>>>>
>>>>
>>>>
>>>>You code says:
>>>>
>>>>$query = "SELECT * FROM ".$list;
>>>>
>>>>Then you issue 
>>>>
>>>>$result = mysql_query($query, $link2DB) or die ("Could not access
>>
>>table
>>
>>>>$list:".mysql_error());
>>>>
>>>>or whatever you want... 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>Community email addresses:
>>>> Post message: php-list@yahoogroups.com
>>>> Subscribe:    [EMAIL PROTECTED]
>>>> Unsubscribe:  [EMAIL PROTECTED]
>>>> List owner:   [EMAIL PROTECTED]
>>>>
>>>>Shortcut URL to this page:
>>>> http://groups.yahoo.com/group/php-list 
>>>>Yahoo! Groups Links
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>Community email addresses:
>>>  Post message: php-list@yahoogroups.com
>>>  Subscribe:    [EMAIL PROTECTED]
>>>  Unsubscribe:  [EMAIL PROTECTED]
>>>  List owner:   [EMAIL PROTECTED]
>>>
>>>Shortcut URL to this page:
>>>  http://groups.yahoo.com/group/php-list 
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>> 
>>>
>>>
>>>
>>>
>>
>>
>>Community email addresses:
>>  Post message: php-list@yahoogroups.com
>>  Subscribe:    [EMAIL PROTECTED]
>>  Unsubscribe:  [EMAIL PROTECTED]
>>  List owner:   [EMAIL PROTECTED]
>>
>>Shortcut URL to this page:
>>  http://groups.yahoo.com/group/php-list 
>>
>>
>>
>>SPONSORED LINKS 
>>Php mysql 
>>Job postings 
>>
>>
>>______________________________________________________________________
>>YAHOO! GROUPS LINKS
>>
>>     1.  Visit your group "php-list" on the web.
>>          
>>     2.  To unsubscribe from this group, send an email to:
>>         [EMAIL PROTECTED]
>>          
>>     3.  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>>        Service.
>>
>>
>>______________________________________________________________________
>>
> 
> 
> 
> 
> Community email addresses:
>   Post message: php-list@yahoogroups.com
>   Subscribe:    [EMAIL PROTECTED]
>   Unsubscribe:  [EMAIL PROTECTED]
>   List owner:   [EMAIL PROTECTED]
> 
> Shortcut URL to this page:
>   http://groups.yahoo.com/group/php-list 
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 


Community email addresses:
  Post message: php-list@yahoogroups.com
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to