[SOLVED]ACP notepad

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

Post Reply
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

[SOLVED]ACP notepad

Post by ziggy3000 »

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.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

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 »

so how should i fix it?

this is the first time i am using mysql in my php code :roll:

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 »

nevermind . i read the manual, and i got it. Thanks!
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

ziggy3000 wrote:nevermind . i read the manual, and i got it. Thanks!
That was the idea. Well done
Post Reply