Forum Moderators: coopster

Message Too Old, No Replies

Simple call function

I think...

         

bobnew32

9:17 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



Ok all I am new to this site and have been reading up on php and mysql and am getting the hang of it. I created a one column table in mysql called Privacy_Statement. I want to call this information into a text table for myself to edit it and submit it back to the database. First of all, I dont know the code to display the Privacy statement in a text box, or in a window of html. Can you please help me with this simple question? Thx

Oh yeah the name of the?table? is Privacy_Statement, and the column that contains the actual text is privacy_text, which is a longtext type.

DrDoc

9:28 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

I don't think you'll need to do this very often... so why not use the phpmyadmin interface that comes with your hosting?

bobnew32

9:52 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



The purpose would be that im storing the privacy statement in the database and would like to display it on a page, so how do you do that then?

DrDoc

10:03 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<?php
$conn = mysql_connect("localhost", "username", "password");
$db = mysql_select_db("database_name");
$result = mysql_query("SELECT privacy_text FROM Privacy_Statement LIMIT 1");
$get = mysql_fetch_row($result);
echo $get[0];
?>

PHP MySQL manual [php.net]

bobnew32

10:13 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



Thank you so much MrDoc, you have made a good friend on this forum! I have been striving to do what you just posted for a while now, thankyou so much for your help, and believe me I searched all over the place for that, but all I ended up doing was connecting to the database and selecting the info, but not displaying it w/echo!

bobnew32

10:16 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



Sorry for double posting, but since I would like to be able that information in a text field, what would be the code to do so, so that when the page loads, a text field appears with the privacy statement in it?

DrDoc

10:22 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, PHP code can be put anywhere...


<textarea name="privacy" cols="35" rows="10"><?php
$conn = mysql_connect("localhost", "username", "password");
$db = mysql_select_db("database_name");
$result = mysql_query("SELECT privacy_text FROM Privacy_Statement LIMIT 1");
$get = mysql_fetch_row($result);
echo $get[0];
?></textarea>


<?php
$conn = mysql_connect("localhost", "username", "password");
$db = mysql_select_db("database_name");
$result = mysql_query("SELECT privacy_text FROM Privacy_Statement LIMIT 1");
$get = mysql_fetch_row($result);
?>
...
<textarea name="privacy" cols="35" rows="10"><?php
echo $get[0];
?></textarea>

bobnew32

10:32 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



What would my submit button look like to submit the change I make of the privacy statement text in the text box? Would it be in the form of:

<form name="form1" method="post" action="">
<input type="submit" name="Submit" value="Submit">
</form>

I'm sorry if I sound ungreatful asking all these questions, its just that your the only person that knows what your talking about that I have seen for.... ever! I really appreciate it.

DrDoc

10:37 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For changes I still recommend using the phpmyadmin section from your control panel. Does your hosting offer that? That's by far the simplest way of making changes... unless you make changes to your privacy statement a lot!

Let us know about the phpmyadmin thingy first...

bobnew32

10:41 pm on Apr 27, 2003 (gmt 0)

10+ Year Member



Well yes I do have phpmyadmin, but as of now I am designing a control panel to have total control of the site (its tv and movies) including the privacy statement (my partner would not know how to use phpmyadmin).

But after I get this working, I would design the control panel to add television show bios and movie bios, which is the next step. Wouldnt it be easy though to be able to add a submit button for the new value of privacy statement? It would just be like deleting the last record and adding a new record if I am correct?

DrDoc

10:48 pm on Apr 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, you wouldn't even have to delete/create... you could just UPDATE the record.

[mysql.com...]

grahamstewart

12:32 am on Apr 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Heres an excellent article from WebMonkey that give you all the basics of php/mysql forms [hotwired.lycos.com].

Read that and all should be clear.