Page 1 of 1

[SOLVED]ACP notepad

Posted: Sat May 19, 2007 11:53 am
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.

Posted: Sat May 19, 2007 1:10 pm
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.

Posted: Sat May 19, 2007 7:07 pm
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.

Posted: Sat May 19, 2007 7:25 pm
by ziggy3000
nevermind . i read the manual, and i got it. Thanks!

Posted: Sun May 20, 2007 4:32 am
by Ollie Saunders
ziggy3000 wrote:nevermind . i read the manual, and i got it. Thanks!
That was the idea. Well done