PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ziggy3000
Forum Contributor
Posts: 205 Joined: Fri Mar 23, 2007 3:04 pm
Post
by ziggy3000 » Sat May 19, 2007 11:53 am
i am creating a mysql-connected notepad on my admin control panel
and i need help getting the info from mysql to the webpage
the tutorials on the web are on a notepad using a text file, not mysql
this is my code so far
Code: Select all
<?php
$_POST['notes'] = $notes;
$result = mysql_query("SELECT `notes` FROM `acp` WHERE `notes`= '$notes'");
if (isset($notes)) {
$rows = mysql_num_rows($result);
if ($rows == 0) {
$query = mysql_query("INSERT INTO `acp` (`notes`) VALUES ('$notes')");
}
else {
$query = mysql_query("UPDATE `acp` SET `notes` = '$notes'");
}
}
?>
and in the textarea i am echoing $result and i get a resource id
please help me.
Last edited by
ziggy3000 on Sat May 19, 2007 7:25 pm, edited 1 time in total.
Ollie Saunders
DevNet Master
Posts: 3179 Joined: Tue May 24, 2005 6:01 pm
Location: UK
Post
by Ollie Saunders » Sat May 19, 2007 1:10 pm
The result is not data but a resource by which you can obtain it. Have a look at mysql_fetch_object() that accepts the result resource as a parameter.
ziggy3000
Forum Contributor
Posts: 205 Joined: Fri Mar 23, 2007 3:04 pm
Post
by ziggy3000 » Sat May 19, 2007 7:07 pm
so how should i fix it?
this is the first time i am using mysql in my php code
when i use the sql in phpmyadmin, i get my result, but not in the php script.
ziggy3000
Forum Contributor
Posts: 205 Joined: Fri Mar 23, 2007 3:04 pm
Post
by ziggy3000 » Sat May 19, 2007 7:25 pm
nevermind . i read the manual, and i got it. Thanks!
Ollie Saunders
DevNet Master
Posts: 3179 Joined: Tue May 24, 2005 6:01 pm
Location: UK
Post
by Ollie Saunders » Sun May 20, 2007 4:32 am
ziggy3000 wrote: nevermind . i read the manual, and i got it. Thanks!
That was the idea. Well done